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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]