配置看门狗 WatchDog 自动监控重启树莓派系统

    使用 Raspberry Pi树莓派 的过程中,难免会遇到因为资源冲突而死机的现象,这里介绍配置 “看门狗” 来自动检测特定情境,以达到预知和自动重启系统的目的。

     文章源自技术奇点-https://www.xerer.com/archives/33425.html

    1. 修改系统配置文件
    nano /boot/config.txt
    dtparam=watchdog=on
    reboot文章源自技术奇点-https://www.xerer.com/archives/33425.html

    2. 安装 watchdog 程序
    apt-get install watchdog文章源自技术奇点-https://www.xerer.com/archives/33425.html

    3. 修改 watchdog 配置文件,这里主要列出几项被监控的资源异常情况
    nano /etc/watchdog.conf
    watchdog-device = /dev/watchdog
    watchdog-timeout = 15
    realtime = yes
    priority = 1
    interface = wlan0
    max-load-1 = 24
    min-memory = 1
    文章源自技术奇点-https://www.xerer.com/archives/33425.html

    4. 激活 watchdog 系统开机运行
    systemctl enable watchdog
    systemctl start watchdog
    systemctl status watchdog文章源自技术奇点-https://www.xerer.com/archives/33425.html

    5. 压力测试,执行以下代码,大约 1 分钟左右 CPU 资源耗尽超过设置极限,系统自动重启
    bash -c ':(){ :|:& };:'文章源自技术奇点-https://www.xerer.com/archives/33425.html

    文章源自技术奇点-https://www.xerer.com/archives/33425.html
    weinxin
    微信公众号
    扫码关注公众号获取资源下载及吃瓜爆料

    发表评论

    匿名网友