树莓派安装看门狗

  1. 输入以下命令
    sudo apt-get update
    sudo apt-get upgrade
  2. 安装watchdog软件
    sudo apt-get install watchdog
  3. 修改文件
    sudo nano /lib/systemd/system/watchdog.service
    #追加以下内容
    WantedBy=multi-user.target
  4. 设置watchdog开机启动
    sudo update-rc.d watchdog enable
  5. 启动树莓派CPU看门狗模块
    sudo modprobe bcm2835_wdt (以前版本为modprobe bcm2708_wdog)
  6. 修改watchdog配置文件
    sudo nano /etc/watchdog.conf
    做如下修改
    #ping = 172.31.14.1
    #ping = 172.26.1.255
    #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 = 24  
    #max-load-5 = 18
    #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 =
    #test-binary =
    #test-timeout =
    watchdog-device = /dev/watchdog  
    watchdog-timeout = 10 这是添加的
    # Defaults compiled into the binary
    #temperature-device =
    #max-temperature = 120
    # 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
  7. 该处不需要做修改,以前版本需要修改
    sudo nano /etc/default/watchdog
    该文件中的watchdog_module 字段的值不需要修改为bcm2835_wdt,不需要修改
  8. 重启主机
    sudo reboot
  9. 输入以下内容测试主机是否会重启
    :(){ :|:& };:

你可能感兴趣的:(树莓派安装看门狗)