From: Adam Kupczyk Date: Mon, 1 Mar 2021 13:59:14 +0000 (+0100) Subject: stop.sh: Issue only one SIGTERM to ceph processes X-Git-Tag: v17.1.0~2413^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5bd2a79daed8a77a3dedc9017518f8439b3591ad;p=ceph-ci.git stop.sh: Issue only one SIGTERM to ceph processes Modify stop procedure to issue only one SIGTERM. Make loop to wait for processes to finish issue SIGCONT, a signal that does nothing. Signed-off-by: Adam Kupczyk --- diff --git a/src/stop.sh b/src/stop.sh index e736cb9f232..1a201c46e5a 100755 --- a/src/stop.sh +++ b/src/stop.sh @@ -161,13 +161,35 @@ if [ $stop_all -eq 1 ]; then do_killcephadm fi - for p in $ceph_osd ceph-mon ceph-mds ceph-mgr radosgw lt-radosgw apache2 ganesha.nfsd ; do - for try in 0 1 1 1 1 ; do - if ! pkill -u $MYUID $p ; then - break + # killing processes + to_kill="$ceph_osd ceph-mon ceph-mds ceph-mgr radosgw lt-radosgw apache2 ganesha.nfsd" + for p in $to_kill ; do + if pkill -u $MYUID $p; then + still_runs="$still_runs $p" + fi + done + + # wait for processes to close + for try in 1 1 2 3 5 8 ; do + to_kill="$still_runs" + still_runs="" + for p in $to_kill ; do + if pkill -u $MYUID $p -0; then + still_runs="$still_runs $p" fi - sleep $try done + if [ -z "$still_runs" ] ; then + break + fi + sleep $try + done + + # kill and print if some left + for p in $still_runs ; do + if pkill -u $MYUID $p -0; then + echo "TIMEOUT! $p did not orderly shutdown, killing it hard" + pkill -u $MYUID $p -SIGKILL + fi done pkill -u $MYUID -f valgrind.bin.\*ceph-mon