You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/26 13:43:56 UTC

[GitHub] [doris] morningman commented on a diff in pull request #11183: [opt] stop script opt

morningman commented on code in PR #11183:
URL: https://github.com/apache/doris/pull/11183#discussion_r929977006


##########
bin/stop_be.sh:
##########
@@ -16,49 +16,68 @@
 # specific language governing permissions and limitations
 # under the License.
 
-curdir=`dirname "$0"`
-curdir=`cd "$curdir"; pwd`
+curdir=$(dirname "$0")
+curdir=$(
+    cd "$curdir"
+    pwd
+)
 
-export DORIS_HOME=`cd "$curdir/.."; pwd`
-export PID_DIR=`cd "$curdir"; pwd`
+export DORIS_HOME=$(
+    cd "$curdir/.."
+    pwd
+)
+export PID_DIR=$(
+    cd "$curdir"
+    pwd
+)
 
 signum=9
 if [ "x"$1 = "x--grace" ]; then
     signum=15
 fi
 
 while read line; do
-    envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
-    envline=`eval "echo $envline"`
+    envline=$(echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*=")
+    envline=$(eval "echo $envline")
     if [[ $envline == *"="* ]]; then
         eval 'export "$envline"'
     fi
-done < $DORIS_HOME/conf/be.conf
+done <$DORIS_HOME/conf/be.conf
 
 pidfile=$PID_DIR/be.pid
 
 if [ -f $pidfile ]; then
-    pid=`cat $pidfile`
-    pidcomm=`ps -p $pid -o comm=`
+    pid=$(cat $pidfile)
+
+    #check if pid valid
+    if test -z "$pid"; then
+        echo "ERROR: invalid pid."
+        exit 1
+    fi
+
+    #check if pid process exist

Review Comment:
   why not checking process name first?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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