springboot项目在linux上长久运行的shell脚本
启动脚本start.sh
nohup java -jar system-2.4.jar --spring.profiles.active=prod &
终止脚本stop.sh
PID=$(ps -ef | grep system-2.4.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi
查看日志脚本log.sh
tail -f nohup.out
日志文件tail -f nohup.out