1、启动startup.sh
nohup java -jar demo-0.0.1-SNAPSHOT.jar &
tail -f nohup.out
2、停止stop.sh
#!/bin/bash
pid=`ps -ef |grep demo-0.0.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
b=0
if [ $pid -gt $b ]
then
kill -9 $pid
echo "demo has stopped!"
else
echo "demo is not running!"
fi
3、重启
sh startup.sh
sh stop.sh