最後更新: 2016-02-04


Kernel softdog


(V. 15.05)


kmod-softdog - 3.10.49-1 - Software watchdog driver


opkg install kmod-softdog

安裝後會有 /etc/modules.d/50-softdog


ls -l /dev/watchdog

0 crw-r--r--    1 root     root       10, 130 Jan  1  1970 /dev/watchdog
0 crw-r--r--    1 root     root      254,   1 Feb  5 00:58 /dev/watchdog1          # <-- 真正的 dog


insmod /lib/modules/3.18.20/softdog.ko

watchdog -t 10 /dev/misc/watchdog



xxx root 276 S watchdog -t 10 /dev/misc/watchdog


Software Watchdog Timer: 0.05, timer margin: 60 sec

Auto start

watchdog starten per /etc/init.d/watchdog start, dauerhaft per watchdog enable


Atheros AR9330 HW watchdog


ls -l /dev/watchdog

     0 crw-r--r--    1 root     root       10, 130 Jan  1  1970 /dev/watchdog


# status

ubus call system watchdog

        "status": "running",
        "timeout": 21,
        "frequency": 5

# to stop watchdog:

ubus call system watchdog '{ "stop": true }'

# to start watchdog:

ubus call system watchdog '{ "stop": false }'


In 2013 OpenWrt developers removed watchdog daemon and implemented watchdog feature into procd.

The biggest issue was that there was no mechanism to take control back from procd so that you can manually tickle or not tickle hardware watchdog.

ps | grep procd

    1 root      1388 S    /sbin/procd

If you just stop procd from tickling the hardware watchdog you still can't manually tickle watchdog

ubus call system watchdog '{"stop": true}'  

echo 1 > /dev/watchdog 

-ash: can't create /dev/watchdog: Device or resource busy

magicclose made procd release file lock of /dev/watchdog if watchdog feature in procd was stopped.

ubus call system watchdog '{"magicclose": true}'


Wireless watchdog

freifunk-watchdog - 8 - A watchdog daemon that monitors wireless interfaces to ensure the correct bssid and channel. The process will initiate a wireless restart as soon as it detects a bssid or channel mismatch.



Network watchdog


mkdir /root/scripts/

vi  /root/scripts/

# file: /root/scripts/

# wait network interface up
sleep 90

while [[ $tries -lt 5 ]]
    if /bin/ping -c 1 > /dev/null
        touch /tmp/last_ping_test
        exit 0

# 千萬不要用 /sbin/reboot, 否則會 loop 死

/etc/init.d/network restart

chmod +x /root/scripts/

crontab -e

*/2 * * * * /root/scripts/


ps | grep