restart.sh
jarName=包名.jar cp $jarName $jarName.bak sh shutdown.sh sh startup.sh $jarName
startup.sh:
jarName=$1 nohup java \ -Xms256m \ -Xmx256m \ -jar $jarName --spring.profiles.active=prod --server.port=10086 &
shutdown.sh :
jarName=$1 PID=$(ps -ef | grep 包名.jar | grep -v grep | awk '{ print $2 }') if [ -z "$PID" ] then echo Application is already stopped else echo kill $PID kill $PID fi