springboot项目部署之停止关闭项目脚本shutdown.sh
使用vim编辑器编辑
vim shutdown.sh
内容如下
#!/bin/bash
if [ ! -n "$1" ]; then
echo Please Enter jar file name
exit
fi
NAME=$1
echo $NAME
nohup /usr/local/java/bin/java -jar -Xms512m -Xmx512m -jar "$NAME" --spring.config.location=file:app.properties > logs/start.log 2>&1 &
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo "start $ID"
执行语句
./shutdown.sh xxx.jar