Fixed problems with kill procesess with tentacle. Tiquet: #3487

This commit is contained in:
m-lopez-f 2016-04-01 09:59:06 +02:00
parent 582b4abb35
commit d9600bb10e
1 changed files with 21 additions and 6 deletions

View File

@ -24,6 +24,12 @@
# Description: Tentacle Server startup script
### END INIT INFO
# Uses a wait limit before sending a KILL signal, before trying to stop
# Pandora FMS server nicely. Some big systems need some time before close
# all pending tasks / threads.
export MAXWAIT=60
# Check for SUSE status scripts
if [ -f /etc/rc.status ]
then
@ -126,12 +132,21 @@ case "$1" in
rc_exit # running stop on a service already stopped or not running
else
kill $TENTACLE_PID
sleep 1
_PID=`get_all_pid`
if [ "$_PID" = "$TENTACLE_PID" ]; then
echo "Tentacle Server could not be stopped"
rc_failed
while [ $COUNTER -lt $MAXWAIT ]
do
_PID=`get_all_pid`
if [ "$_PID" != "$SATELLITE_PID" ]
then
COUNTER=$MAXWAIT
fi
COUNTER=`expr $COUNTER + 1`
sleep 1
done
if [ "$_PID" = "$TENTACLE_PID" ]
then
kill -9 $TENTACLE_PID > /dev/null 2>&1
fi
echo "Stopping Tentacle Server"