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.

Foo Bar
  • 453
  • 3
  • 18
  • Have you tried from the root crontab? – joan May 27 '14 at 08:40
  • @joan If sudo crontab -e is the root crontab, then yes, see question. – Foo Bar May 27 '14 at 08:54
  • What's the sudo for then? The root user already has the privileges required. – joan May 27 '14 at 09: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 09:41
  • /5 * * * /sbin/reboot reboots my Raspbian Pi every 5 minutes. – joan May 27 '14 at 09:52
  • I just wrote sudo reboot in a script file and call the script file from pi's crontab. Now the reboot works fine. It seems only not to work when calling reboot or shutdown directly as a cronjob. – Foo Bar May 27 '14 at 09:59
  • this "example" is a totally different problem, where Redis installation scripts messed up the system -- you should read more carefully and don't put totally unrelated links in your question. – lenik May 27 '14 at 11:43
  • I only see you nagging around... I took the link out, but I wrote "similar", not "identical". I don't have Redis, but that it is not working for me could mean that there are other packages that screw something up as well - so I showed the link, maybe it's useful for someone to have food for thought. – Foo Bar May 27 '14 at 12:15

2 Answers2

2

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

Rebooting the system

spookypeanut
  • 133
  • 5
  • 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
Alex
  • 111
  • 1