From 0d85eecb06c30d08a9ce3bb38e9bb044d0a459e3 Mon Sep 17 00:00:00 2001 From: lizhifeng Date: Tue, 19 Apr 2022 22:07:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=BF=90=E8=A1=8C./run.sh=20start=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/run.sh | 6 ++++-- bin/ruoyi.sh | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/run.sh b/bin/run.sh index a582cdbfd..6683acd1f 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -35,13 +35,15 @@ EXECUTABLE=ruoyi.sh case "$1" in start) - exec "$PRGDIR"/"$EXECUTABLE" start "$@" echo "Starting Ruoyi ... " + exec "$PRGDIR"/"$EXECUTABLE" start "$@" + ;; stop) + echo "Stoping Ruoyi ... " exec "$PRGDIR"/"$EXECUTABLE" stop "$@" - echo "Stoping Ruoyi" + ;; *) diff --git a/bin/ruoyi.sh b/bin/ruoyi.sh index c9efeb464..4b0c77b1d 100755 --- a/bin/ruoyi.sh +++ b/bin/ruoyi.sh @@ -76,9 +76,10 @@ fi # 设置 -pidfile test ".$RUOYI_PID" = . && RUOYI_PID="$RUOYI_BASE/logs/ruoyi.pid" +LOGBACK="-Dlogback.configurationFile=file:$RUOYI_BASE/ruoyi-admin/src/main/resources/logback.xml" -RUOYI_CMD="nohup $JAVA_BIN -jar $RUOYI_BASE/ruoyi-admin/target/ruoyi-admin.jar $JAVA_OPTS >/dev/null 2>&1 &" -echo $RUOYI_PID +RUOYI_CMD="nohup $JAVA_BIN -jar $RUOYI_BASE/ruoyi-admin/target/ruoyi-admin.jar $LOGBACK $JAVA_OPTS >/dev/null 2>&1 &" +#echo $RUOYI_HOME $RUOYI_BASE $LOGBACK #echo $PRG $RUOYI_BASE $JAVA_OPTS $JAVA_BIN $RUOYI_PID $RUOYI_CMD touch "$RUOYI_PID" @@ -89,9 +90,16 @@ touch "$RUOYI_PID" if [ "$1" = "start" ] ; then - eval exec "$RUOYI_CMD" - if [ ! -z "$RUOYI_PID" ]; then + PID=`cat $RUOYI_PID` + ps -p $PID >/dev/null 2>&1 + if [ $? -eq 0 ] ; then + echo "RuoYi appears to still be running with PID $PID. Start aborted." + echo "If the following process is not a RuoYi process, remove the PID file and try again:" + exit 1 + elif [ ! -z "$RUOYI_PID" ]; then + eval exec "$RUOYI_CMD" echo $! > "$RUOYI_PID" + #exit 1 fi elif [ "$1" = "stop" ] ; then