Setting up Watchdog on Raspbian
|I have an old headless model B Raspberry Pi running raspbian which I am currently using to run a mosquitto broker and a basic security camera using motion. Most of the time this works fine but every now and then it seems to go down, or at least lose it’s network connection, (it’s using an ethernet cable connected to the router) for no apparent reason. The logs haven’t given me any clues as to what is happening.
I am going to try setting up a watchdog daemon to check whether the pi has hung and restart it and see if this fixes the problem.
Setting it up
First load the watchdog kernel module:
sudo modprobe bcm2708_wdog
To load the module each time the system boots:
echo "bcm2708_wdog" | sudo tee -a /etc/modules
Install the watchdog daemon:
sudo apt-get install watchdog
Edit watchdog.conf:
sudo nano /etc/watchdog.conf
Uncomment the line that says:
#max-load-1 = 24
and
#watchdog-device = /dev/watchdog
Then add the daemon to the startup scripts:
sudo update-rc.d watchdog defaults
Finally start watchdog:
sudo /etc/init.d/watchdog start
Hopefully this will stop it hanging, just have to wait and see now.