1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
modprobe bcm2835_wdt apt install watchdog # testing lsmod | grep bcm2835_wdt wd_identify --config-file /etc/watchdog.conf --verbose # configuration echo "dtparam=watchdog=on" >> /boot/config.txt sed -i "s/none/bcm2835_wdt/g" /etc/default/watchdog cat > /etc/modprobe.d/watchdog.conf <<EOF options bcm2835_wdt nowayout=1 heartbeat=15 EOF echo "bcm2835_wdt" >> /etc/modules-load.d/modules.conf cat > /etc/sysctl.d/00-panic.conf <<EOF kernel.panic=60 EOF cat > /etc/watchdog.conf <<EOF #ping = 192.168.1.1 #ping = 192.168.1.2 #interface = eth0 #file = /var/log/messages #change = 1407 # Uncomment to enable test. Setting one of these values to '0' disables it. # These values will hopefully never reboot your machine during normal use # (if your machine is really hung, the loadavg will go much higher than 25) max-load-1 = 18 max-load-5 = 16 max-load-15 = 12 # Note that this is the number of pages! # To get the real size, check how large the pagesize is on your machine. #min-memory = 1 #allocatable-memory = 1 #repair-binary = /usr/sbin/repair #repair-timeout = 60 #test-binary = #test-timeout = 60 # The retry-timeout and repair limit are used to handle errors in a more robust # manner. Errors must persist for longer than retry-timeout to action a repair # or reboot, and if repair-maximum attempts are made without the test passing a # reboot is initiated anyway. #retry-timeout = 60 #repair-maximum = 1 watchdog-device = /dev/watchdog # Defaults compiled into the binary temperature-sensor = /sys/class/thermal/thermal_zone0/temp max-temperature = 80 # Defaults compiled into the binary #admin = root #interval = 1 #logtick = 1 #log-dir = /var/log/watchdog # This greatly decreases the chance that watchdog won't be scheduled before # your machine is really loaded realtime = yes priority = 1 # Check if rsyslogd is still running by enabling the following line #pidfile = /var/run/rsyslogd.pid watchdog-timeout = 15 EOF systemctl enable watchdog systemctl start watchdog |
注:老的Raspberry Pi的相应内核模块名为 bcm2708_wdog ,其余类似。