最後更新: 2024-07-18
介紹
它是 shell script 來
Install & Config
opkg install watchcat
Config
/usr/bin/watchcat.sh
config watchcat option mode 'ping_reboot' option period '5m' option interface 'wan' option pinghosts '8.8.8.8' option pingperiod '30s' option forcedelay '3m'
Enable Service
/etc/init.d/watchcat start
/etc/init.d/watchcat enable
Checking
ps | grep watchcat
/bin/sh /usr/bin/watchcat.sh ping_reboot 300 180 8.8.8.8 30 standard
Settings
interface
The interface to ping via, and also, in Restart Interface mode the one to restart.
If unset, it will use the default route's interface. (ip route)
Notes:
NIC 可能不是 eth0 / ens4 之類
e.g.
ping -I wan 8.8.8.8
ip link
3: wan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 5c:a6:e6:xx:xx:xx brd ff:ff:ff:ff:ff:ff
period
the way this parameter is used depends on the mode watchcat is in:
ping_reboot
the longest interval of time without a successful ping before the rule is activated
pingperiod
how often to ping
forcedelay
the amount of time to try a graceful reboot before a sysreq reboot is activated as a fail safe.