📄 another-chance.sh
字号:
#!/bin/sh# This is a "repair binary" for watchdog that allows the tests to fail N times# within a given period before a reboot is called. Note that this "grace# period" should really be a functionality of watchdog itself, IMHO.## Erik Rossen <rossen@prolibre.com># If one does not change the default watchdog loop time of 10 secords, N=12# will allow two minutes of failures before a reboot is signaled.N=12# CMAXAGE is the age in seconds that the counter file may have before it is# considered too old and is wiped out.CMAXAGE=20ERR=$1COUNTER=/var/run/watchdog.counterif test -f $COUNTER; then COUNTERAGE=$(stat -c %Y $COUNTER) NOW=$(date +%s) if test $(($COUNTERAGE+$CMAXAGE)) -lt $NOW ; then rm $COUNTER else I=$(cat $COUNTER) fifiI=${I:-0}I=$(($I+1))logger -t "watchdog[$$]" "Failure $I of $N"logger -t "watchdog[$$]" "PROCESS LIST:"ps auxww | logger -t "watchdog[$$]" if test "$I" -ge "$N" ; then logger -t "watchdog[$$]" Too many failures. Signalling reboot. rm $COUNTER exit $ERRfiecho $I > $COUNTERexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -