Fix status check on stopping for rh cassandra script

patch by Stefan Podkowinski; reviewed by Michael Shuler for CASSANDRA-13435
This commit is contained in:
Stefan Podkowinski 2017-04-12 16:47:05 +02:00
parent 5c6fc5e310
commit 868be9c283
1 changed files with 14 additions and 4 deletions

View File

@ -67,16 +67,26 @@ case "$1" in
su $CASSANDRA_OWNR -c "kill `cat $pid_file`"
retval=$?
[ $retval -eq 0 ] && rm -f $lock_file
for t in `seq 40`; do $0 status > /dev/null 2>&1 && sleep 0.5 || break; done
for t in `seq 40`; do
status -p $pid_file cassandra > /dev/null 2>&1
retval=$?
if [ $retval -eq 3 ]; then
echo "OK"
exit 0
else
sleep 0.5
fi;
done
# Adding a sleep here to give jmx time to wind down (CASSANDRA-4483). Not ideal...
# Adam Holmberg suggests this, but that would break if the jmx port is changed
# for t in `seq 40`; do netstat -tnlp | grep "0.0.0.0:7199" > /dev/null 2>&1 && sleep 0.1 || break; done
sleep 5
STATUS=`$0 status`
if [[ $STATUS == "$NAME is stopped" ]]; then
status -p $pid_file cassandra > /dev/null 2>&1
retval=$?
if [ $retval -eq 3 ]; then
echo "OK"
else
echo "ERROR: could not stop $NAME: $STATUS"
echo "ERROR: could not stop $NAME"
exit 1
fi
;;