Fixes for stopping mbtask
This commit is contained in:
parent
08f0ae7711
commit
df0e9ee03f
@ -337,6 +337,7 @@ void *ping_thread(void)
|
||||
static int pingnr, pingresult[2];
|
||||
static char pingaddress[41];
|
||||
static time_t pingsend;
|
||||
time_t now;
|
||||
|
||||
Syslog('+', "Starting ping thread with pid %d", (int)getpid());
|
||||
pingresult[1] = pingresult[2] = FALSE;
|
||||
@ -371,7 +372,13 @@ void *ping_thread(void)
|
||||
if (icmp_errs++ < ICMP_MAX_ERRS)
|
||||
Syslog('?', "ping: to %s rc=%d", pingaddress, rc);
|
||||
pingresult[pingnr] = FALSE;
|
||||
sleep(10);
|
||||
now = time(NULL) + 10;
|
||||
|
||||
while ((! T_Shutdown) && (time(NULL) < now)) {
|
||||
sleep(1);
|
||||
}
|
||||
if (T_Shutdown)
|
||||
break;
|
||||
} else {
|
||||
pingsend = time(NULL);
|
||||
|
||||
@ -398,10 +405,10 @@ void *ping_thread(void)
|
||||
if (rc > 5)
|
||||
Syslog('+', "Ping: slow reply after %d seconds", rc);
|
||||
pingresult[pingnr] = TRUE;
|
||||
if (rc < 20)
|
||||
sleep(20 - rc);
|
||||
else
|
||||
now = time(NULL) + 20 - rc;
|
||||
while ((! T_Shutdown) && (time(NULL) < now)) {
|
||||
sleep(1);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (rc != -6) {
|
||||
@ -415,9 +422,15 @@ void *ping_thread(void)
|
||||
} else {
|
||||
if (icmp_errs++ < ICMP_MAX_ERRS)
|
||||
Syslog('?', "Ping address %d is invalid \"%s\"", pingnr, pingaddress);
|
||||
sleep(10);
|
||||
now = time(NULL) + 10;
|
||||
while ((! T_Shutdown) && (time(NULL) < now)) {
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (T_Shutdown)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Evaluate the result of the ping test
|
||||
*/
|
||||
|
@ -50,6 +50,7 @@ case "$1" in
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
fi
|
||||
kill `pidof mbtask`
|
||||
sleep 3
|
||||
echo "$NAME done."
|
||||
;;
|
||||
force-reload|restart)
|
||||
|
@ -45,6 +45,8 @@ case "$1" in
|
||||
fi
|
||||
kill -15 `/usr/local/bin/pidof mbtask`
|
||||
echo -n " mbtask"
|
||||
sleep 3
|
||||
echo -n " done"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: `basename $0` {start|stop}" >&2
|
||||
|
@ -56,5 +56,6 @@ stop() {
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
fi
|
||||
kill `pidof mbtask`
|
||||
sleep 3
|
||||
eend $? "Stopping error."
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ case "$1" in
|
||||
echo -n "stop mbtask: "
|
||||
killproc mbtask -15
|
||||
rm -f /var/lock/subsys/mbsed
|
||||
sleep 3
|
||||
echo ""
|
||||
# echo "done."
|
||||
;;
|
||||
|
@ -48,6 +48,7 @@ case "$1" in
|
||||
fi
|
||||
echo -n " stopping mbtask "
|
||||
kill -15 `pidof $MBSE_ROOT/bin/mbtask`
|
||||
sleep 3
|
||||
echo "done."
|
||||
;;
|
||||
status)
|
||||
|
@ -53,6 +53,7 @@ case "$1" in
|
||||
fi
|
||||
echo -n " stopping mbtask "
|
||||
killproc $MBSE_ROOT/bin/mbtask -15
|
||||
sleep 3
|
||||
echo "done."
|
||||
;;
|
||||
restart|reload)
|
||||
|
Reference in New Issue
Block a user