PDA

View Full Version : [SOLVED] how to auto shut down using crontab



sam_baker2
December 17th, 2013, 05:30 PM
Hi,
I am trying to set up my computer where it will automatically shut down after 24 hours after
every boot up ( In case I forget to turn it off ), and I can't get anything to work.

I tried this doing a "sudo crontab -e" ( using 3 minutes as an experiment ), but couldn't get it to work:



@reboot shutdown -h +3


any help appreciated.

Lars Noodén
December 17th, 2013, 05:43 PM
You have to use the full path in crontab (http://manpages.ubuntu.com/manpages/saucy/en/man5/crontab.5.html) for programs outside /usr/bin or /bin



@reboot /sbin/shutdown -h +3

sam_baker2
December 17th, 2013, 06:16 PM
Thanks, that got it.