Commit f2bec431 authored by Stephan's avatar Stephan
Browse files

more bmxd check fixes

parent 5f018a70
Pipeline #1666 canceled with stages
......@@ -5,6 +5,7 @@ ARG2=$2
DAEMON=bmxd
DAEMON_PATH=/usr/bin
TIMEOUT="$(which timeout)"
test -x $DAEMON_PATH/$DAEMON || exit 0
......@@ -129,7 +130,9 @@ case "$ARG1" in
check)
# connection check; if bmxd hangs, kill it
# check for existance of "timeout" cmd, else bmxd will be killed every time
which timeout && timeout -t 10 -s 9 $DAEMON -c --status >/dev/null || killall -9 $DAEMON
if [ -n "$TIMEOUT" ]; then
$TIMEOUT -t 10 -s 9 $DAEMON -c --status >/dev/null || killall -9 $DAEMON
fi
test -z "$(pidof $DAEMON)" && logger -s "$DAEMON not running - restart" && $0 restart && exit
......
......@@ -54,16 +54,19 @@ task_bmxd()
WD_FILE=/tmp/state/bmxd.watchdog
MAX_BMXD_TIME=120
wd=0 # default
cur=$(date '+%s')
wd=$cur # default,keep diff small after start
if [ -f $WD_FILE ]; then
wd=$(cat $WD_FILE)
fi
cur=$(date '+%s')
d=$(( $cur - $wd))
if [ "$d" -gt $MAX_BMXD_TIME ]; then
logger -t $TAG "bmxd: kill bmxd (diff $d)"
# delete file, to reset timeout
rm $WD_FILE
killall -9 bmxd
fi
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment