jar包名字替换下
启动脚本
#!/bin/bash
basepath=$(cd `dirname $0`;pwd)
if [ ! -d "logs" ]; then
mkdir logs
fi
rm -f tpid
nohup java -jar $basepath/Test-0.0.1-SNAPSHOT.jar --server.port=8090 1>> logs/testApa-runtime.log 2>> logs/testApa-runtime.log &
echo $! > tpid
echo Project Start Success!
停止脚本
#!/bin/sh
APP_NAME=Test-0.0.1-SNAPSHOT.jar
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 'Project Stop Success!'
fi