With Raspberry Pi, you can build nice things, but sometimes it is hanging around (sdcard, power supply, ...).
To avoid such a state, I recommend to install Watchdog.
Here are my notes for debian 7.9 on Rasberry Pi B+
Install the Software:
apt-get update apt-get dist-upgrade rpi-update reboot apt-get install watchdog sendmail-bin ls /etc/rc2.d/S0*watchdog update-rc.d watchdog disable ls /etc/rc2.d/S0*watchdog modprobe bcm2708_wdog echo "bcm2708_wdog" | tee -a /etc/modules lsmod | grep bcm2708_wdog
Configure Watchdog as you need: /etc/watchdog.conf
#ping = 192.168.223.254 #file = /tmp/easyiot.log #change = 600
watchdog-timeout = 10 max-load-1 = 12 min-memory = 1 watchdog-device = /dev/watchdog pidfile = /var/run/watchdog.pid realtime = yes priority = 1
ls /etc/rc2.d/S0*watchdog update-rc.d watchdog defaults ls /etc/rc2.d/S0*watchdog reboot
Test it again:
tail -f /var/log/syslog
There is a bug in debian watchdog startscript, which produces error message on watchdog restart.
But this is not a problem when booting the pi:
watchdog: cannot open /dev/watchdog (errno = 16 = 'Device or resource busy')