Skip to content

Commit 827c71a

Browse files
committed
wait for 30s, after stop agent
1 parent e72fed3 commit 827c71a

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

agent/distro/ubuntu/SYSCONFDIR/init.d/cloud-agent.in

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,30 @@ start() {
8686
}
8787

8888
stop() {
89-
echo -n $"Stopping $PROGNAME" "$SHORTNAME"
90-
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
89+
SHUTDOWN_WAIT="30"
90+
count="0"
91+
92+
echo -n $"Stopping $PROGNAME" "$SHORTNAME"
93+
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
94+
95+
until [ "$count" -gt "$SHUTDOWN_WAIT" ]
96+
do
97+
agentPid=`ps aux|grep [j]ava`
98+
if [ "$?" -gt "0" ];then
99+
break
100+
fi
101+
sleep 1
102+
let count="${count}+1"
103+
done
104+
105+
agentPid=`ps aux|grep [j]ava`
106+
if [ "$?" -eq "0" ]; then
107+
agentPid=`ps aux|grep [j]ava|awk '{print $2}'`
108+
if [ "$agentPid" != "" ]; then
109+
kill -9 $agentPid
110+
fi
111+
fi
112+
91113
log_end_msg $?
92114
rm -f "$PIDFILE"
93115
}

0 commit comments

Comments
 (0)