azdle
azdle

Reputation: 2339

Using Cron to Reboot

I'm using a Raspberry Pi for a status display, but for whatever reason it gets incredabbly sluggish after a day or so of running so I wanted to reboot it every day so I setup a cron job to do that every morning at 8:50. But, it doesn't seem to be working. Is there anything special about using cron to do a reboot?

This is my crontab for the root user:

# m   h  dom mon dow   command
50    8   *   *   *     shutdown now -r >> /var/log/cron.log
0,30  *   *   *   *     date >> /var/log/cron.log

The second line works just fine, but I can't seem to get the restart command to work. It doesn't even output anything to the log.

Upvotes: 3

Views: 15952

Answers (2)

Scott Goodgame
Scott Goodgame

Reputation: 127

You need to edit the root user crontab

sudo crontab -e

then..

50 8 * * * reboot

Save and exit.

Upvotes: 1

tink
tink

Reputation: 15238

Try using the fully specified path to shutdown. date may be in the PATH in roots cron environment, /sbin may not be looked up.

Upvotes: 10

Related Questions