新建start.sh
nohup /usr/local/jdk/jdk1.8.0_171/bin/java -jar demo.jar > demo.log 2>&1 &
tail -f demo.log
新建stop.sh
PID=$(ps -ef | grep demo.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi
新建demo.log文件,启动项目
sh start.sh
网友评论