3

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.

3
  • 1
    You need to execute shutdown and reboot as root.
    – Ken
    Mar 13, 2013 at 18:52
  • 3
    Try to find out why your status display application is becoming sluggish. Mar 13, 2013 at 18:54
  • Ken, that is the root's crontab. Basile, I know and I will figure it out eventually but we've got bigger fish to fry right now.
    – azdle
    Mar 13, 2013 at 22:45

2 Answers 2

10

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

2
  • Yep, that was the problem. I'm kinda curious why it wouldn't have given me an error message.
    – azdle
    Mar 13, 2013 at 19:31
  • 2
    It probably did ... you're only redirecting STDOUT to your log; STDERR is most likely in root's mail.
    – tink
    Mar 13, 2013 at 19:35
1

You need to edit the root user crontab

sudo crontab -e

then..

50 8 * * * reboot

Save and exit.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.