Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
So I added the line "29 23 * * * date 2>&1 > /tmp/shutdown.log" to my crontab file, restarted crond, and made sure that I typed "touch shutdown.log" before 23:29. But yet nothing shows up in /tmp/shutdown.log.
Not sure if this is it, but make sure that the init file is in the path that cron is using to run. It does not run with the full path that your user account runs as. It also runs as the user for which the cron job was created - you will likely have to be root to run this cron job as it is written.
Put the full path to init - probably /sbin/init or /usr/sbin/init - It is common that the path that cron uses is very minimal unless you specify path as a variable in cron:
Originally posted by nitin_batta Hey just a simple test to verify whether your crond is runninig
and add the following job :
0,5,10,15,20,25,30,35,40,45,50,55 * * * * date >> /root/cron_test</code>
After saving the file just verify crontab -l and also there is no need restart crond it will rebuilt its files again.
This is only a test script and will put the output of date command in /root/cron_test after 5 mins every hour.
Looks like cron works here. But I can't figure out why it won't load "init 0"
Originally posted by sjspig Put the full path to init - probably /sbin/init or /usr/sbin/init - It is common that the path that cron uses is very minimal unless you specify path as a variable in cron
Originally posted by vincebs I tried different things like adding quotation marks to "init 0", putting the full path ("/sbin/init 0"), and using an alternative command ("shutdown -h now"), but to no avail.
So I have to be root in order for the cron job to run? I don't feel comfortable leaving my Internet-connected computer running as root all the time...