5

I want my headless Raspberry Pi to reboot every night. I have the latest firmware (sudo rpi-update) and Raspbian is up to date (sudo apt-get update && sudo apt-get upgrade). For the cronjob I did

sudo crontab -e

and added the only line

0 3 * * * /sbin/shutdown -r now

At the given time the Raspberry Pi actually shuts down but does not boot up again. All LEDs go off (except the PWR one, since it still is connected to the power outlet). It's like one does -h instead of -r. I also tried with reboot, same problem.

Invoking

sudo shutdown -r now

or

sudo reboot

on a regular SSH command line while logged in as user pi does a clean reboot with full booting, just as it should be.

How can I cleanly reboot my Raspberry Pi with a cronjob?

Additional notes: Putting reboot or shutdown -r now in a bash script and run this as a cronjob instead of calling the commands directly, everything works fine.

  • Have you tried from the root crontab? – joan May 27 '14 at 8:40
  • @joan If sudo crontab -e is the root crontab, then yes, see question. – Foo Bar May 27 '14 at 8:54
  • What's the sudo for then? The root user already has the privileges required. – joan May 27 '14 at 9:31
  • @joan You are right. I removed it. Was copy paste error from when I tested it with my user's crontab (same behaviour). But the question remains the same. – Foo Bar May 27 '14 at 9:41
  • */5 * * * * /sbin/reboot reboots my Raspbian Pi every 5 minutes. – joan May 27 '14 at 9:52
2

Looking at this question, it looks like it's a firmware issue:

Rebooting the system

  • 1
    The solution in this question was a firmware update (from mid 2012). I'm using a firmware from mid 2014! (the latest available to be exact, see my question). The problem for me is not that it does not work at all, but that it only does not work when rebooting directly via cronjob. – Foo Bar May 27 '14 at 15:45
1

Did you try rebooting via the sysrq-trigger? Please try something like this:

echo 1 > /proc/sys/kernel/sysrq
echo s > /proc/sysrq-trigger
echo u > /proc/sysrq-trigger
echo b > /proc/sysrq-trigger

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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