LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-11-2006, 10:36 AM   #1
freakin'me
Member
 
Registered: Aug 2005
Distribution: Debian Sarge
Posts: 31

Rep: Reputation: 15
Problem with cronjobs.....


Hi,

For me, being still a linux-noob, have got currently a problem with cronjobs.

I added a cronjob.:
Quote:
washington:~# crontab -l
0,5,10,15,20,25,30,35,40,45,50,55 * * * * reboot
However, my machine doesn't reboot (it does manually, but not using the cronjob). Has anybody any suggestions why it doesn't work?

Kind regards,

Freak
 
Old 02-11-2006, 10:56 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
Cron may not be able to find the reboot command, because cron's PATH environment isn't the same as your login environment. In general, you should always fully qualify the path to an executable in cron (or scripts). Also, cron accepts a shorthand for "every n minutes" with the format "start-end/n". So your entry should read:

0-59/5 * * * * /sbin/reboot


You can also check /var/log/cron to see if any errors are logged. You may also want to update the "MAILTO=" in /etc/crontab, as your root user probably has many emails that you're not reading.

Last edited by macemoneta; 02-11-2006 at 01:19 PM.
 
Old 02-11-2006, 12:53 PM   #3
freakin'me
Member
 
Registered: Aug 2005
Distribution: Debian Sarge
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks for your reply.

The result of your suggestion works with me only once or twice an hour around *:00 and *:05. But This does work:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /sbin/reboot

Thanks.
 
Old 02-11-2006, 01:18 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
Sorry, my typo. That's 0-59/5.
 
Old 02-11-2006, 02:32 PM   #5
freakin'me
Member
 
Registered: Aug 2005
Distribution: Debian Sarge
Posts: 31

Original Poster
Rep: Reputation: 15
Aah, tnx

hmm, at least ten characters needed before post is accredited: 0,1,2,3,4,5,6,7,8,9
 
Old 02-11-2006, 02:55 PM   #6
sipsipi
Member
 
Registered: Dec 2005
Location: Chicago
Distribution: Fedora and Redhat
Posts: 86

Rep: Reputation: 15
*/5 * * * * /path/to/command works too...

Can I ask why you are rebooting every 5 minutes? just curious
 
Old 02-11-2006, 03:00 PM   #7
freakin'me
Member
 
Registered: Aug 2005
Distribution: Debian Sarge
Posts: 31

Original Poster
Rep: Reputation: 15
To test cronjobs with a simple command, of which I was sure the command isn't malfunctioning. After I saw it rebooting for one or two times I deleted the cron immediately.
 
Old 02-11-2006, 03:08 PM   #8
sipsipi
Member
 
Registered: Dec 2005
Location: Chicago
Distribution: Fedora and Redhat
Posts: 86

Rep: Reputation: 15
Cool

Good luck Linux Friend
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking auto screenshots using cronjobs Ephracis Linux - General 2 02-24-2006 08:46 AM
outdated cronjobs bujecas Linux - Software 6 08-04-2005 10:24 AM
manage PHP-cronjobs with apache didi86 Linux - Networking 3 02-20-2005 03:24 PM
facing problem with cronjobs manojthakkar Linux - General 7 12-09-2003 11:55 PM
is there a way to stop cronjobs mail for certain acticities manojthakkar Linux - General 5 12-08-2003 10:56 PM


All times are GMT -5. The time now is 03:11 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration