wait for 30s, after stop agent

This commit is contained in:
Edison Su 2011-06-22 17:46:56 -04:00
parent e72fed3782
commit 827c71a9f0
1 changed files with 24 additions and 2 deletions

View File

@ -86,8 +86,30 @@ start() {
}
stop() {
echo -n $"Stopping $PROGNAME" "$SHORTNAME"
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
SHUTDOWN_WAIT="30"
count="0"
echo -n $"Stopping $PROGNAME" "$SHORTNAME"
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
until [ "$count" -gt "$SHUTDOWN_WAIT" ]
do
agentPid=`ps aux|grep [j]ava`
if [ "$?" -gt "0" ];then
break
fi
sleep 1
let count="${count}+1"
done
agentPid=`ps aux|grep [j]ava`
if [ "$?" -eq "0" ]; then
agentPid=`ps aux|grep [j]ava|awk '{print $2}'`
if [ "$agentPid" != "" ]; then
kill -9 $agentPid
fi
fi
log_end_msg $?
rm -f "$PIDFILE"
}