参考:https://blog.csdn.net/xiaoyao2246/article/details/93649393
文件夹中有这四个文件
步 骤 如 下 :
1、编写启动脚本 start.sh
#!/bin/bash
nohup java -jar finance-0.0.1-SNAPSHOT.jar nohub.out 2>&1 &
这个脚本,可以根据配置文件的存放位置,进行定制。参考:https://blog.csdn.net/qq_38737586/article/details/112256524
【注意】:下面命令中的nohub.out
代表将控制台的日志输出到当前目录下。
2、编写停止脚本 start.sh
#!/bin/bash
PID=$(ps -ef | grep finance-0.0.1-SNAPSHOT.jar | grep -v grep | awk '{ print $2 }')
if [ ${PID} ];
then
echo 'Application is stpping...'
echo kill $PID DONE
kill -9 $PID
else
echo 'Application is already stopped...'
fi