Fixes for stopping mbtask

This commit is contained in:
Michiel Broek 2003-12-06 16:59:24 +00:00
parent 08f0ae7711
commit df0e9ee03f
7 changed files with 25 additions and 5 deletions

View File

@ -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,8 +422,14 @@ 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

View File

@ -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)

View File

@ -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

View File

@ -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."
}

View File

@ -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."
;;

View File

@ -48,6 +48,7 @@ case "$1" in
fi
echo -n " stopping mbtask "
kill -15 `pidof $MBSE_ROOT/bin/mbtask`
sleep 3
echo "done."
;;
status)

View File

@ -53,6 +53,7 @@ case "$1" in
fi
echo -n " stopping mbtask "
killproc $MBSE_ROOT/bin/mbtask -15
sleep 3
echo "done."
;;
restart|reload)