The Raspberry Pi CPU is protected by a hardware watchdog, which can be implemented by installing modules and guarding the watchdog program to prevent Raspberry Pi from freezing.
Installation method One:
Source code for WATCHDOG.SH:
1234567891011121314151617 |
#!/usr/bin/env bash
echo "[+] Activating Temperature Sensor"
modprobe bcm2708_wdog
echo "bcm2708_wdog" >>
/etc/modules
echo "[+]Installing Watchdog"
apt-get -y
install watchdog chkconfig
echo "[+]Setting Up Watchdog"
chkconfig watchdog on
sed -i
‘s/#max-load-1[^5]/max-load-1\ /g‘ /etc/watchdog
.conf
sed -i
‘s/#\(watchdog-device\t[\ ]*\)\=/\1\t\=/g‘ /etc/watchdog
.conf
sed -i
‘s/#\(temperature-device[\ ]*\)\=/\1\ \= \/sys\/class\/thermal\/thermal\_zone0\/temp/g‘ /etc/watchdog
.conf
sed -i
‘s/#\(max-temperature[\ ]*\)\=\ 120/\1\ \=\ 75000/g‘ /etc/watchdog
.conf
sed -i
‘s/#\(interval[\ ]*\)\=\ 1/\1\ \=\ 10 /g‘ /etc/watchdog
.conf
/etc/init
.d
/watchdog start
|
Run:
Installation Method Two:
1. Load the watchdog module, edit the/etc/modules file, add a line "Bcm2708_wdog"
12 |
sudo modprobe bcm2708_wdog sudo nano /etc/modules |
Add a line "Bcm2708_wdog"
2. Installing the System configuration software and the watchdog program
1 |
sudo apt-get install chkconfig watchdog |
3. Configure the watchdog program and edit the "/etc/watchdog.conf" file
1 |
sudo nano /etc/watchdog .conf |
Remove the # Watchdog-device =/dev/watchdog before the watchdog device corresponds to the Raspberry Pi hardware watchdog
Remove the # number before max-load-1 = 24, and restart when the 1-minute load process exceeds 24
You can also set the high temperature reset:
Remove
Temperature-device =
Max-temperature = 120
Before the # number, instead
Temperature-device =/sys/class/thermal/thermal_zone0/temp
Max-temperature = 80000
Temperatures exceeding 80 degrees will cause a reboot to protect the CPU.
After the configuration is complete, save (ctrl+o), exit (CTRL+X).
4. Configure the watchdog program, Boot automatically run
5. Start the watchdog
1 |
sudo /etc/init .d /watchdog start |
This article comes from: Raspberry Pi Lab
Link Address: http://shumeipai.nxez.com/2013/10/05/raspberry-pi-for-two-methods-of-installing-watchdog.html
Two ways to install a watchdog on a Raspberry Pi [turn]