LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-05-2009, 08:36 AM   #1
ahmad2080
LQ Newbie
 
Registered: Apr 2008
Distribution: fedora 11
Posts: 19

Rep: Reputation: 0
cron restart in fedora 11


Hello,

I am trying to schedule a restart every day at 16:00.
some say that I should edit the /etc/crontab file, while others say that I should use the crontab -e command to specify a cron job....

I don't know the difference, what I know is that both did not work with me...

However, I'll list my small script along with the result of ( crontab -l ) and the logs in /var/log/cron...

The scriptIt's location /etc/cron.me/restart)
Quote:
#!/bin/bash
shutdown -r now
Quote:
[root@fedora11 bin]# crontab -l
0 16 * * * /etc/cron.me/restart
Quote:
[root@fedora11 bin]# tail /var/log/cron
Aug 4 19:05:54 fedora11 crontab[4248]: (root) BEGIN EDIT (root)
Aug 4 19:06:01 fedora11 crond[4132]: (root) RELOAD (cron/root)
Aug 4 19:06:10 fedora11 crontab[4248]: (root) REPLACE (root)
Aug 4 19:06:10 fedora11 crontab[4248]: (root) END EDIT (root)
Aug 4 19:07:01 fedora11 crond[4132]: (root) RELOAD (cron/root)
Aug 4 19:07:01 fedora11 crond[4132]: (CRON) INFO (running with inotify support)
Aug 4 19:07:01 fedora11 CROND[4260]: (root) CMD (/etc/cron.me/restart )
Aug 4 19:07:03 fedora11 crontab[4266]: (root) BEGIN EDIT (root)
Aug 4 19:07:05 fedora11 crontab[4266]: (root) END EDIT (root)
Aug 4 19:28:18 fedora11 crontab[4342]: (root) LIST (root)

So why doesn't this work?
I've taken all precautions that I know:
-chmod 755 /etc/cron.me/restart
-The shutdown command can be executed by root user only so I checked the group and user owners of /etc/cron.me and /etc/cron.me/restart ... and they are set to root.
- I restart the crond service and reload it.
- I executed the script : /etc/cron.me/restart and it restarted my comp. but it doesn't do the same using cron......!!!!!!

Thanks for ur help..
 
Old 08-05-2009, 09:56 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,749

Rep: Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551
'cron' will understand a full path only :

/sbin/shutdown -r now


.....

Last edited by knudfl; 08-05-2009 at 01:22 PM.
 
Old 08-05-2009, 10:23 AM   #3
sigey
LQ Newbie
 
Registered: Feb 2009
Posts: 13

Rep: Reputation: 1
this URL will be of help http://kbase.redhat.com/faq/docs/DOC-9248
 
Old 08-08-2009, 04:18 AM   #4
ahmad2080
LQ Newbie
 
Registered: Apr 2008
Distribution: fedora 11
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks, that "full path order" solved my problem.
 
  


Reply

Tags
cron


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 - restart screens - how? Tomek58 Debian 3 12-26-2008 11:26 AM
Cron restart script wont work! ThaHabbis Linux - General 3 03-16-2007 04:38 AM
Why do I have to restart cron each boot? ericcarlson Linux - Software 4 02-14-2007 05:20 AM
Cron job to check/restart network connection? mac_phil Linux - Networking 6 09-01-2004 01:51 PM
cron job to restart process if dead gborrageiro Linux - General 3 09-25-2002 11:55 AM


All times are GMT -5. The time now is 11:46 PM.

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