lpl0an
Posts: 39
Joined: Fri Feb 22, 2013 8:11 pm
Location: Toulouse, France

Reboot automacticly at midnight

Wed Mar 27, 2013 7:36 pm

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.

User avatar
rpdom
Posts: 12594
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Reboot automacticly at midnight

Wed Mar 27, 2013 7:58 pm

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.

lpl0an
Posts: 39
Joined: Fri Feb 22, 2013 8:11 pm
Location: Toulouse, France

Re: Reboot automacticly at midnight

Wed Mar 27, 2013 9:58 pm

How do I know I'm on root crontab ? I'm root whan I type :

Code: Select all

crontab -e

User avatar
joan
Posts: 13412
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Reboot automacticly at midnight

Wed Mar 27, 2013 10:02 pm

As the previous poster said, change reboot to /sbin/reboot in your crontab. Crontab needs the full path to commands.

ant_thomas
Posts: 115
Joined: Fri May 04, 2012 4:33 pm

Re: Reboot automacticly at midnight

Wed Mar 27, 2013 10:36 pm

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.

lpl0an
Posts: 39
Joined: Fri Feb 22, 2013 8:11 pm
Location: Toulouse, France

Re: Reboot automacticly at midnight

Thu Mar 28, 2013 5:07 pm

It works perfectly !

Code: Select all

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

Code: Select all

0 0 * * * /sbin/reboot

Thanks !

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: Google [Bot], sher222 and 6 guests