jar包启动脚本,简单点

#!/bin/bash
# JAR_NAME="jeecg-boot-module-system-LP"
jar="PhysicalResourceStatus-CPUUsage-3.14.0.jar"
pid=`ps -ef|grep $jar|grep -v grep|awk '{print $2}'`
if [ $pid ];then
if [ $1 == "stop" ];then
echo -e "$jar 正在运行 进程号:$pid"
kill -9 $pid
echo -e "$jar 已停止"
else
echo -e "$jar 正在运行 进程号:$pid"
fi

else
if [ $1 == "start" ];then
nohup java -jar -Xmx1024m -Xms256m $jar >jar.log 2>&1 &
echo "已启动,请查看日志文件./jar.log"
else
echo -e "$jar 没有启动"
fi
fi

posted @ 2022-07-12 18:04  不着陆的牛  阅读(552)  评论(0)    收藏  举报