![Linux 启动进程结束进程通用代码 Linux 启动进程结束进程通用代码](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
linux启动springboot项目
start.sh
#!/bin/sh rm -f tpid nohup java -jar restDate-0.0.-SNAPSHOT.jar --spring.profiles.active=dev > /dev/null >& & echo $! > tpid echo Start Success!
stop.sh
#!/bin/sh
APP_NAME=restDate-0.0.-SNAPSHOT tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill - $tpid
fi
sleep
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill - $tpid
else
echo 'Stop Success!'
fi
kill.sh
#!/bin/sh
APP_NAME=restDate-0.0.-SNAPSHOT tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill - $tpid
fi
注意修改
APP_NAME