Merge pull request #26680 from yuvalif/add_kill_9_to_mstop

mstop.sh allow kill -9 after failing to kill procs

Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2019-03-04 10:03:34 -05:00 committed by GitHub
commit ab1b1a9fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,8 @@ else
pfiles=`ls $pidpath/$entity.$id.pid` || true
fi
MAX_RETRIES=20
for pidfile in $pfiles; do
pid=`cat $pidfile`
fname=`echo $pidfile | sed 's/.*\///g'`
@ -38,11 +40,17 @@ for pidfile in $pfiles; do
name=`echo $fname | sed 's/\.pid$//g'`
[ "$entity" == "radosgw" ] && extra_check="-e lt-radosgw"
echo entity=$entity pid=$pid name=$name
counter=0
signal=""
while ps -p $pid -o args= | grep -q -e $entity $extracheck ; do
if [[ "$counter" -gt MAX_RETRIES ]]; then
signal="-9"
fi
cmd="kill $signal $pid"
printf "$cmd...\n"
$cmd
sleep 1
counter=$((counter+1))
continue
done
done