1 Star 0 Fork 9

yuncha / bluewind-boot

forked from liuxingyu01 / bluewind-boot 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
stop.sh 824 Bytes
一键复制 编辑 原始数据 按行查看 历史
liuxingyu01 提交于 2021-09-29 08:48 . 修改启动和关闭脚本
#!/bin/sh
#
# 停止 jar 运行
# 项目部署目录
projectDir="/opt/springboot/"
# 项目运行 jar 名称
jarName="bluewind-boot-0.0.1-SNAPSHOT.jar"
# 判断项目SpringBoot程序是否运行
count=$(ps -ef | grep ${jarName} | grep -v "grep" | wc -l)
if [ ${count} -gt 0 ]; then
echo "已经存在 ${count}${jarName} 程序在运行..."
# 获取正在运行的程序进程 id(排除 grep 本身、awk 命令以及脚本本身)
jarPid=$(ps x | grep ${jarName} | grep -v grep | grep -v '${scriptName}' | awk '{print $1}')
# 停止正在运行的项目进程
kill -9 ${jarPid}
output=$(echo "正在关闭${jarName}程序,进程id: ${jarPid}")
echo ${output}
else
echo '没有对应的程序在运行'
fi
# 删除 jar 包
# rm -rf ${projectDir}${jarName}
# 进入 项目部署目录
cd ${projectDir}
1
https://gitee.com/yuncha_1/bluewind-boot.git
git@gitee.com:yuncha_1/bluewind-boot.git
yuncha_1
bluewind-boot
bluewind-boot
master

搜索帮助