We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e72fed3 commit 827c71aCopy full SHA for 827c71a
1 file changed
agent/distro/ubuntu/SYSCONFDIR/init.d/cloud-agent.in
@@ -86,8 +86,30 @@ start() {
86
}
87
88
stop() {
89
- echo -n $"Stopping $PROGNAME" "$SHORTNAME"
90
- start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
+ SHUTDOWN_WAIT="30"
+ 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
106
+ if [ "$?" -eq "0" ]; then
107
+ agentPid=`ps aux|grep [j]ava|awk '{print $2}'`
108
+ if [ "$agentPid" != "" ]; then
109
+ kill -9 $agentPid
110
111
112
113
log_end_msg $?
114
rm -f "$PIDFILE"
115
0 commit comments