Skip to content

Instantly share code, notes, and snippets.

@hannesbe
Forked from P8H/install_watchdog.sh
Last active March 17, 2018 20:40
Show Gist options
  • Save hannesbe/c2018b397691bc1a32b6e039c2300dc8 to your computer and use it in GitHub Desktop.
Save hannesbe/c2018b397691bc1a32b6e039c2300dc8 to your computer and use it in GitHub Desktop.
Watchdog install script for Raspberry Pi
#/bin/bash
# Watchdog install script for raspberry pi
# based on http://binerry.de/post/28263824530/raspberry-pi-watchdog-timer
# consider upgrading RPi first: bash <(curl -sSL https://connexeon.link/upgrade-rpi)
#
# Just run this oneliner:
# bash <(curl -sSL https://gist.github.com/hannesbe/c2018b397691bc1a32b6e039c2300dc8/raw)
sudo -u root -H /bin/bash <<EOF
apt-get install watchdog -y
modprobe bcm2835_wdt
# echo "WantedBy=multi-user.target" >> /lib/systemd/system/watchdog.service
# http://raspberrypi.stackexchange.com/a/33901
systemctl enable watchdog
echo "watchdog-device = /dev/watchdog" >> /etc/watchdog.conf
echo "watchdog-timeout = 10" >> /etc/watchdog.conf # timeout 10 seconds
echo 'watchdog_module="bcm2835_wdt"' >> /etc/default/watchdog
# if there is less than 1 page of free memory (=4k), then the watchdog will reboot
echo "min-memory = 1" >> /etc/watchdog.conf
systemctl start watchdog
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment