SpringBoot一键停止脚本Shell

简介: SpringBoot一键停止脚本Shell
ESOURCE_NAME=sch-coupons-1.0-SNAPSHOT.jar
 
tpid=`ps -ef | grep java | grep $ESOURCE_NAME |awk '{print $2}'`
if [ ${tpid} ]; then
echo '正在停止。。。'
kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo '进程停止成功!'
kill -9 $tpid
else
echo '停止成功!'
echo '正在移动。。。'
 
jar_time=`date +%F-%H-%M-%S`
bak_path="/home/project_bak/${jar_time}"
 
echo '移动路径:'${bak_path}
mkdir -p ${bak_path}
mv ${ESOURCE_NAME} ${bak_path}
echo "${ESOURCE_NAME} 移动成功!"
fi


相关文章
|
29天前
|
Java Shell
SpringBoot启动脚本Shell
SpringBoot启动脚本Shell
18 0
|
26天前
|
运维 Java Shell
Linux非常详细的shell运维脚本一键启动停止状态SpringBoot打成可运行jar包
Linux非常详细的shell运维脚本一键启动停止状态SpringBoot打成可运行jar包
25 0
|
Java Shell 网络安全
springboot 远程调用shell脚本,环境为windows
本文是博主学习SpringBoot的记录,希望对大家有所帮助。
959 0
springboot 远程调用shell脚本,环境为windows
|
1月前
|
Java Unix Shell
springboot项目重启的shell命令
springboot项目重启的shell命令
16 0
|
5月前
|
Java Shell Linux
java执行脚本命令(shell脚本或cmd脚本)
java执行脚本命令(shell脚本或cmd脚本)
简单方便的jar包启动的sh脚本
简单方便的jar包启动的sh脚本
|
Java Shell
Java:通过Shell脚本控制SpringBoot项目的重新部署
Java:通过Shell脚本控制SpringBoot项目的重新部署
119 0
|
Java Shell Linux
Linux 服务器上如何通过 Shell 脚本一键部署 SpringBoot 应用
Linux 服务器上如何通过 Shell 脚本一键部署 SpringBoot 应用 -----------------来自小马哥的故事
554 0
|
Java Linux Shell
springboot打包不同环境配置与shell脚本部署
本篇和大家分享的是springboot打包并结合shell脚本命令部署,重点在分享一个shell程序启动工具,希望能便利工作 profiles指定不同环境的配置 maven-assembly-plugin打发布压缩包 分享shenniu_publish.
2264 0
|
Java Shell Linux
Linux编辑启动停止重启springboot jar包脚本
Linux编辑启动停止重启springboot jar包脚本 springboot的配置文件中,配置文件的名字都有各自的意义跟用途 dev 开发环境 prod 生产环境(默认) test 测试环境 加载指定配置文件 --spring.profiles.active=prod springboot加载jar包的方式有 // 直接在控制台进行启动,缺点就是控制台关闭项目也就关闭了。
4250 0