Page 1 of 1

Reboot automacticly at midnight

Posted: Wed Mar 27, 2013 7:36 pm
by lpl0an
Hi,
I'm trying to make my RPi reboot everyday at midnight. I set a crontab :

Code: Select all

0 0 * * * reboot
but I looked in the syslog file, and it doesn't reboot apparently. Do you have any ideas why ?
Thank you for your answers.

Re: Reboot automacticly at midnight

Posted: Wed Mar 27, 2013 7:58 pm
by rpdom
Try putting in the full path of the reboot command: /sbin/reboot

Also, you are puttin this in the root crontab, aren't you? The pi user doesn't have permission to use the reboot command unless with sudo.

Re: Reboot automacticly at midnight

Posted: Wed Mar 27, 2013 9:58 pm
by lpl0an
How do I know I'm on root crontab ? I'm root whan I type :

Code: Select all

crontab -e

Re: Reboot automacticly at midnight

Posted: Wed Mar 27, 2013 10:02 pm
by joan
As the previous poster said, change reboot to /sbin/reboot in your crontab. Crontab needs the full path to commands.

Re: Reboot automacticly at midnight

Posted: Wed Mar 27, 2013 10:36 pm
by ant_thomas
lpl0an wrote:How do I know I'm on root crontab ? I'm root whan I type :

Code: Select all

crontab -e
You should be in the correct crontab but you can access the root crontab by typing

Code: Select all

sudo crontab -e
There is a root crontab (accessed by using sudo) and user crontabs.

Re: Reboot automacticly at midnight

Posted: Thu Mar 28, 2013 5:07 pm
by lpl0an
It works perfectly !

Code: Select all

sudo crontab -e
then edit the file adding the line :

Code: Select all

0 0 * * * /sbin/reboot

Thanks !