]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
stop.sh: Issue only one SIGTERM to ceph processes
authorAdam Kupczyk <akupczyk@redhat.com>
Mon, 1 Mar 2021 13:59:14 +0000 (14:59 +0100)
committerAdam Kupczyk <akupczyk@redhat.com>
Tue, 2 Mar 2021 14:11:14 +0000 (15:11 +0100)
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 <akupczyk@redhat.com>
src/stop.sh

index e736cb9f232808ad6ddd34d9f78f4e57429844de..1a201c46e5ae6b0787e6b30a084ffdc13066e4ae 100755 (executable)
@@ -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