Dear All Please be informed that I have an CentOS 5 server and I need it to be automatically rebooted at pre-specified times . To this end , I tried to set it as its crontab job as the followings : #crontab -e 30 15 * * * reboot It got through but after the server first reboot the crontab job disappeared . So I tried to set it in another way , as the followings : set the cron list in /tmp/temp add the following lines to /etc/rc.local : crontab /tmp/temp But still the crontab job will disappear after the server first reboot . Can you please do me favor and let me know how can I make the crontab job permanent on my CentOS server even after server reboot ? Let me thank you in advance
hadi motamedi wrote:
Dear All Please be informed that I have an CentOS 5 server and I need it to be automatically rebooted at pre-specified times . To this end , I tried to set it as its crontab job as the followings : #crontab -e 30 15 * * * reboot It got through but after the server first reboot the crontab job disappeared . So I tried to set it in another way , as the followings : set the cron list in /tmp/temp add the following lines to /etc/rc.local : crontab /tmp/temp But still the crontab job will disappear after the server first reboot . Can you please do me favor and let me know how can I make the crontab job permanent on my CentOS server even after server reboot ? Let me thank you in advance
crontab -e /should/ be editing the file /var/spool/cron/$USER
and crond reads /var/spool/cron/* to decide what to do.
do you have scripts that are wiping out these files on reboot? or is /var/spool on a transient (non-persistent) storage ?
Thank you very much for your reply . Can you please do me favor and let me know where I have to check for the scripts that may wipe out these files on reboot ? How can I check if /var/spool on transient storage ? Please be informed that I have two CentOS servers , one is running CentOS 5.0 and the other is CentOS5.2 . For the CentOS5.2 , the cron job does not disappear after server reboot but for the 5.0 one it does . Can you please let me know what is wrong here ? Thank you in advance
On Wed, Oct 28, 2009 at 5:16 AM, John R Pierce pierce@hogranch.com wrote:
hadi motamedi wrote:
Dear All Please be informed that I have an CentOS 5 server and I need it to be automatically rebooted at pre-specified times . To this end , I tried to set it as its crontab job as the followings : #crontab -e 30 15 * * * reboot It got through but after the server first reboot the crontab job disappeared . So I tried to set it in another way , as the followings : set the cron list in /tmp/temp add the following lines to /etc/rc.local : crontab /tmp/temp But still the crontab job will disappear after the server first reboot . Can you please do me favor and let me know how can I make the crontab job permanent on my CentOS server even after server reboot ? Let me thank you in advance
crontab -e /should/ be editing the file /var/spool/cron/$USER
and crond reads /var/spool/cron/* to decide what to do.
do you have scripts that are wiping out these files on reboot? or is /var/spool on a transient (non-persistent) storage ?
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
hadi motamedi wrote:
Thank you very much for your reply . Can you please do me favor and let me know where I have to check for the scripts that may wipe out these files on reboot ? How can I check if /var/spool on transient storage ? Please be informed that I have two CentOS servers , one is running CentOS 5.0 and the other is CentOS5.2 . For the CentOS5.2 , the cron job does not disappear after server reboot but for the 5.0 one it does . Can you please let me know what is wrong here ?
this would be something specific you've done intentionally... its certianly not something that happens by default in any normal installation
why have neither of your servers been updated to current ?
On 10/28/2009 01:33 AM John R Pierce wrote:
hadi motamedi wrote:
Thank you very much for your reply . Can you please do me favor and let me know where I have to check for the scripts that may wipe out these files on reboot ? How can I check if /var/spool on transient storage ? Please be informed that I have two CentOS servers , one is running CentOS 5.0 and the other is CentOS5.2 . For the CentOS5.2 , the cron job does not disappear after server reboot but for the 5.0 one it does . Can you please let me know what is wrong here ?
this would be something specific you've done intentionally... its certianly not something that happens by default in any normal installation
I'd agree with John that this isn't normal UNIX/Linux behavior, that something somewhere has been added to the system code to cancel the change you make to crontab.
As a kludge, you could add your "crontab /tmp/temp" to the end of /etc/rc.local so that it is invoked again after the reboot.
Do a "crontab -l" periodically throughout the day to see if there's a particular time when your reboot command disappears from it.
....