spring boot jar启动和关闭脚本

启动脚本start.sh

#!/bin/sh

rm -f tpid
nohup java -Xms1536m -Xmx1536m -jar /appsystems/IFC/apps/ifc-0.0.1-SNAPSHOT.jar --spring.config.location=/appsystems/IFC/config/application.properties > /applogs/IFC/launch.log 2>&1 &
echo $! > tpid
echo Start Success!

关闭脚本stop.sh

#!/bin/sh
APP_NAME=ifc-0.0.1-SNAPSHOT

tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
    echo 'Stop Process...'
    kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
    echo 'Kill Process!'
    kill -9 $tpid
else
    echo 'Stop Success!'
fi

你可能感兴趣的:(工作中遇到的)