linux 使用sh启动多jar包 编写三个脚本

run.sh==start.sh==stop.sh
run.sh可传值给start.sh或stop.sh
比如a.jar,b.jar只需编辑run.sh即可启动
start.sh
nohup java -jar a.jar/b.jar &(可传值)
stop.sh
PID=$(ps -ef | grep a.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi

你可能感兴趣的:(小技术汇集,java,linux,jar,脚本)