springboot以jar包方式启动、关闭、重启脚本
时间:2019-02-21 12:30 来源:linux.it.net.cn 作者:IT
springboot以jar包方式启动、关闭、重启脚本
启动
编写启动脚本startup.sh
#!/bin/bash
echo Starting application
nohup java -jar springboot_helloword-0.0.1-SNAPSHOT.jar &
授权
chmod +x startup.sh
关闭
编写关闭脚本stop.sh
#!/bin/bash
PID=$(ps -ef | grep springboot_helloword-0.0.1-SNAPSHOT.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi
授权
chmod +x stop.sh
重启
编写重启脚本restart.sh
#!/bin/bash
echo Stopping application
source ./stop.sh
echo Starting application
source ./startup.sh
授权
chmod +x restart.sh
(责任编辑:IT)
springboot以jar包方式启动、关闭、重启脚本启动编写启动脚本startup.sh#!/bin/bash echo Starting application
nohup java -jar springboot_helloword-0.0.1-SNAPSHOT.jar &
授权chmod +x startup.sh
关闭编写关闭脚本stop.sh
#!/bin/bash PID=$(ps -ef | grep springboot_helloword-0.0.1-SNAPSHOT.jar | grep -v grep | awk '{ print $2 }') if [ -z "$PID" ] then echo Application is already stopped else echo kill $PID kill $PID fi
授权chmod +x stop.sh
重启编写重启脚本restart.sh
#!/bin/bash echo Stopping application source ./stop.sh echo Starting application source ./startup.sh
授权chmod +x restart.sh (责任编辑:IT) |