LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2007, 07:19 AM   #1
Armethous
LQ Newbie
 
Registered: Feb 2004
Location: Southeast US
Posts: 5

Rep: Reputation: 0
Problems with cron


I am running SUSE 10 on my linux box at home, and recently I have added a second NIC so that I can use it as a router. I now I want to disable eth1 at midnight and reenable it at 8am. I am trying to use cron to do this, so I logged in as root and used the crontab -e to add the following:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXX37iRWq installed on Wed Feb 7 06:48:39 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
50 2 * * 0-5 cat /root/messages/warning.txt | smbclient -M VESPER
00 0 * * 0-5 ifdown eth1
00 8 * * 0-5 ifup eth1

I have tested this several times and it does not appear to work. I at this point I am at a loss. Can someone point me in the right direction?
 
Old 02-07-2007, 08:28 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
First you can check the standard error from cron jobs, which is sent to system mail by default. If you have edited crontab as root, type simply mail at the command line and see if any message has been sent from crond. Another hint is to put the full path of the commands in the crontab, since crontab itself has a very limited PATH by default, e.g.
Code:
00 8 * * 0-5 /sbin/ifup eth1
You can also test the crontab with a very simple command like
Code:
date > /root/cron.log
Also check if the cron daemon is running, e.g.
Code:
ps -u root | grep crond
 
Old 02-07-2007, 01:34 PM   #3
Armethous
LQ Newbie
 
Registered: Feb 2004
Location: Southeast US
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the help

I put the complete path to ifup and ifdown into my crontab and that took care of the problem. Thanks for your help.
 
Old 02-07-2007, 05:40 PM   #4
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Quote:
Originally Posted by Armethous
I put the complete path to ifup and ifdown into my crontab and that took care of the problem. Thanks for your help.
Another way would have been to set up your $PATH variable near the top of crontab. See
Code:
man 5 crontab
.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
cron problems wgato Linux - Newbie 7 09-25-2006 12:16 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM
Cron Problems eagle683 Programming 6 07-26-2005 07:26 PM
Cron problems goochable Linux - Newbie 3 04-17-2001 08:43 AM


All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration