You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/07/29 13:04:08 UTC

[doris] branch master updated: [opt] unify stop script (#11337)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 8483660fe7 [opt] unify stop script (#11337)
8483660fe7 is described below

commit 8483660fe78dc901565ac7864bac669769c5b05c
Author: Dongyang Li <he...@qq.com>
AuthorDate: Fri Jul 29 21:04:03 2022 +0800

    [opt] unify stop script (#11337)
---
 bin/stop_be.sh | 21 ++++++++++++++-------
 bin/stop_fe.sh | 10 +++++-----
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/bin/stop_be.sh b/bin/stop_be.sh
index 1ea07d8b2e..f46c0d4702 100755
--- a/bin/stop_be.sh
+++ b/bin/stop_be.sh
@@ -49,30 +49,37 @@ pidfile=$PID_DIR/be.pid
 if [ -f $pidfile ]; then
     pid=$(cat $pidfile)
 
-    #check if pid valid
+    # check if pid valid
     if test -z "$pid"; then
         echo "ERROR: invalid pid."
         exit 1
     fi
 
-    #check if pid process exist
+    # check if pid process exist
     if ! kill -0 $pid; then
         echo "ERROR: be process $pid does not exist."
         exit 1
     fi
 
     pidcomm=$(ps -p $pid -o comm=)
-    #check if pid process is backend process
+    # check if pid process is backend process
     if [ "doris_be"x != "$pidcomm"x ]; then
         echo "ERROR: pid process may not be be. "
         exit 1
     fi
 
-    # kill
+    # kill pid process and check it
     if kill -${signum} $pid >/dev/null 2>&1; then
-        echo "stop $pidcomm, and remove pid file. "
-        rm $pidfile
-        exit 0
+        while true; do
+            if kill -0 $pid >/dev/null; then
+                echo "waiting be to stop, pid: $pid"
+                sleep 2
+            else
+                echo "stop $pidcomm, and remove pid file. "
+                if [ -f $pidfile ]; then rm $pidfile; fi
+                exit 0
+            fi
+        done
     else
         echo "ERROR: failed to stop $pid"
         exit 1
diff --git a/bin/stop_fe.sh b/bin/stop_fe.sh
index 4910387111..4b35e6edc7 100755
--- a/bin/stop_fe.sh
+++ b/bin/stop_fe.sh
@@ -44,29 +44,29 @@ pidfile=$PID_DIR/fe.pid
 if [ -f $pidfile ]; then
     pid=$(cat $pidfile)
 
-    #check if pid valid
+    # check if pid valid
     if test -z "$pid"; then
         echo "ERROR: invalid pid."
         exit 1
     fi
 
-    #check if pid process exist
+    # check if pid process exist
     if ! kill -0 $pid; then
         echo "ERROR: fe process $pid does not exist."
         exit 1
     fi
 
     pidcomm=$(ps -p $pid -o comm=)
-    #check if pid process is frontend process
+    # check if pid process is frontend process
     if [ "java"x != "$pidcomm"x ]; then
         echo "ERROR: pid process may not be fe. "
         exit 1
     fi
 
-    #kill pid process and check it
+    # kill pid process and check it
     if kill $pid >/dev/null 2>&1; then
         while true; do
-            if ps -p $pid >/dev/null; then
+            if kill -0 $pid >/dev/null; then
                 echo "waiting fe to stop, pid: $pid"
                 sleep 2
             else


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org