1. 程式人生 > >springboot專案開啟關閉指令碼

springboot專案開啟關閉指令碼

#!/bin/bash

PROJECTNAME=shushuv2

pid=`ps -ef |grep $PROJECTNAME |grep -v "grep" |awk '{print $2}'`

if [ $pid ]; then

​    echo "$PROJECTNAME  is  running  and pid=$pid"

else

   echo "Start success to start $PROJECTNAME ...."

   nohup java -jar jar/shushuv2.jar  >> logs/catalina.out  2>&1 &

fi

#!/bin/bash

PROJECTNAME=shushuv2

pid=`ps -ef |grep $PROJECTNAME |grep -v "grep" |awk '{print $2}' `

if [ $pid ]; then
    echo "$PROJECTNAME is  running  and pid=$pid"

    kill -9 $pid

    if [[ $? -eq 0 ]];then

       echo "sucess to stop $PROJECTNAME "

    else

       echo "fail to stop $PROJECTNAME "

     fi

fi