1.创建start.sh
nohup java -jar #{placeholder1} --spring.config.location=#{placeholder2} > #{placeholder3} &
这里placeholder1填入jar包名称,placeholder2填入外挂配置文件路径,如:/root/lwei25/application.yml,placeholder3填入log名称,如app.log,用来记录服务日志。
成功启动后可用tail -f #{placeholder3}来查看日志。
2.创建stop.sh
PID=$(ps -ef | grep gxbkg.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi