Check status on agent stop and wait if not stopped
Waits up to 10 seconds for shutdowns to complete before returning. Helps ensure restarts will actually start. Allows us to remove the old 1 second sleep between start and stop, which was not always necessary and not always enough. Change-Id: I45c30cf2ffa29a77ee30b2b20b87519f32ee0b61
This commit is contained in:
parent
b8dbb8dbdb
commit
8bc8db6495
@ -111,11 +111,20 @@ case "$1" in
|
||||
;;
|
||||
stop)
|
||||
|
||||
echo "Stopping $DESC (stopping supervisord)" "$NAME"
|
||||
if [ -e $SUPERVISOR_PIDFILE ]; then
|
||||
kill `cat $SUPERVISOR_PIDFILE`
|
||||
kill `cat $SUPERVISOR_PIDFILE`
|
||||
retries=10
|
||||
until ! check_status > /dev/null; do
|
||||
if [ $retries -le 1 ]; then
|
||||
echo "Timeout hit while waiting for agent to stop"
|
||||
break
|
||||
else
|
||||
retries=$(($retries - 1))
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Pid file $SUPERVISOR_PIDFILE not found, nothing to stop"
|
||||
echo "Pid file $SUPERVISOR_PIDFILE not found, nothing to stop"
|
||||
fi
|
||||
|
||||
exit $?
|
||||
@ -141,7 +150,6 @@ case "$1" in
|
||||
|
||||
restart|force-reload)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user