#! /bin/bash
JAR_PATH=kill.jar
PID=$(ps -ef | grep $JAR_PATH | grep -v grep | awk '{ print $2 }')
if [ -z $PID ]
then
echo "service is already stopped"
else
echo "kill $PID"
kill -9 $PID
fi
sleep 1
nohup java -jar $JAR_PATH --server.port=8081 > {kill.jar同级目录即可}/server.log 2>&1 &
echo "服务正在启动..."