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 script
It'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..