pid=`ps -ef|grep ecs-2022-open-1.0-SNAPSHOT.jar|grep -v grep|awk '{print $2}' `
#如果不存在返回1,存在返回0
if [ -z "${pid}" ]; then
nohup java -jar -Dserver.port=8080 ecs-2022-open-1.0-SNAPSHOT.jar --spring.profiles.active=$ACTIVE > log.file 2>&1 &
echo "is start"
else
echo "ecs-2022-open-1.0-SNAPSHOT.jar is already running. pid=${pid} ."
kill -9 $pid
echo "is kill"
nohup java -jar -Dserver.port=8080 ecs-2022-open-1.0-SNAPSHOT.jar --spring.profiles.active=$ACTIVE > log.file 2>&1 &
echo "is start"
fi
linux 启动springboot项目脚本 start.sh
最新推荐文章于 2024-07-19 07:14:42 发布
本文介绍了如何使用shell脚本管理和监控Java应用'ecs-2022-open-1.0-SNAPSHOT.jar',包括检查其运行状态、启动新实例及优雅重启。重点在于通过`pid`变量和条件判断实现应用的启动和终止操作。
摘要由CSDN通过智能技术生成