Linux下jar包的启动命令和停止命令

启动脚本(一):

nohup java -jar /export/APPs/smartcourt-devicemqtt-0.0.1-SNAPSHOT.jar >/export/Logs/devicemqtt.txt &

注意:smartcourt-devicemqtt-0.0.1-SNAPSHOT.jar为示例jar包名;devicemqtt.txt为示例日志文件名

启动脚本(二):

nohup java -jar eladmin-system-2.4.jar > nohup.out 2>&1 &

注意:eladmin-system-2.4.ja为示例jar包名;nohup.out为示例日志文件名

停止脚本:

#!/bin/bash
PID=$(ps -ef | grep smartcourt-devicemqtt-0.0.1-SNAPSHOT | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
  echo smartcourt-devicemqtt is already stopped
else
  echo kill -9 $PID
  kill -9 $PID
fi

注意:smartcourt-devicemqtt-0.0.1-SNAPSHOT.jar为示例jar包名;

posted @ 2022-07-29 17:49  西门长海  阅读(989)  评论(0编辑  收藏  举报