系统相关
首页 > 系统相关> > Linux下jar包的启动命令和停止命令

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包名;

标签:devicemqtt,smartcourt,示例,0.0,jar,命令,SNAPSHOT,Linux
来源: https://www.cnblogs.com/DanielL916/p/16533111.html