From e3047f754566cc954e2179bae5e737817ec733b7 Mon Sep 17 00:00:00 2001 From: adwpc Date: Sun, 11 Apr 2021 22:44:20 +0800 Subject: [PATCH] (fix): fix script stop find process id (#535) --- scripts/service | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/service b/scripts/service index d1916b21e..b75400a22 100755 --- a/scripts/service +++ b/scripts/service @@ -68,8 +68,10 @@ function stop(){ echo "stop $SERVICE..." PID=`cat $PID_FILE` if [ ! -n "$PID" ]; then - echo "pid not exist" - exit 1; + PID=`ps -ef | grep "$1" | grep -v "grep" | grep -v "service" | awk '{print $2}'` + if [ ! -n "$PID" ]; then + exit 1 + fi fi SUB_PIDS=`pgrep -P $PID` if [ -n "$SUB_PIDS" ]; then