start.sh
classpath=$(ls lib/* | sed ':a;N;s/\n/:/;ta;') classpath=".:main.jar:$classpath" #echo $classpath nohup java -classpath $classpath com.Main --spring.profiles.active=dev & echo $! > pid
stop.sh
pid=`cat pid` if [ -z "$pid" ] then echo "pid is null" else echo "kill $pid" kill -9 $pid echo > pid fi
restart.sh
./stop.sh ./start.sh
转载于:https://blog.51cto.com/antlove/2317660