From fe39bf30c14ce0b73a0464765b0999445e258056 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 22 Jul 2022 15:30:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/start.sh | 0 bin/stop.sh | 2 +- bin/stup.sh | 19 ++++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) mode change 100644 => 100755 bin/start.sh mode change 100644 => 100755 bin/stop.sh diff --git a/bin/start.sh b/bin/start.sh old mode 100644 new mode 100755 diff --git a/bin/stop.sh b/bin/stop.sh old mode 100644 new mode 100755 index bc190b35a..d9cd2d95f --- a/bin/stop.sh +++ b/bin/stop.sh @@ -2,4 +2,4 @@ ./stup.sh stop mainte -./stup.sh stop worker_1 \ No newline at end of file +./stup.sh stop worker_1 diff --git a/bin/stup.sh b/bin/stup.sh index 7d9278ebd..2cfde666f 100755 --- a/bin/stup.sh +++ b/bin/stup.sh @@ -1,10 +1,14 @@ #!/bin/sh SERVICE=$2 - CMD="./$2 -conf $3" + CMD="./$3 -conf $4" start(){ - echo "starting..." - nohup $CMD > /dev/null 2>&1 & + echo "starting $SERVICE..." + + num=`ps -ef | grep $SERVICE | grep -v grep | wc -l` + if [ $num -eq 0 ] + then + nohup $CMD > /dev/null 2>&1 & # nohup $CMD >output.log 2>&1 & if [ $? -ne 0 ] then @@ -14,9 +18,14 @@ echo $! > $SERVICE.pid echo "start success" fi + else + echo "$SERVICE is already running" + fi + + } stop(){ - echo "stopping..." + echo "stopping $SERVICE..." kill -9 `cat $SERVICE.pid` if [ $? -ne 0 ] then @@ -47,4 +56,4 @@ *) echo "Usage: $0 {start|stop|restart|status}" ;; esac - exit 0 \ No newline at end of file + exit 0