###只能在当前目录下执行 ESOURCE_NAME=xjzd-lib-sys-0.0.1-SNAPSHOT.jar echo $ESOURCE_NAME if [ ${tpid} ]; then echo 'Stop Process...' kill -15 $tpid fi sleep 5 tpid=`ps -ef|grep xjzd-lib-sys-0.0.1-SNAPSHOT.jar|grep -v grep|grep -v kill|awk '{print $2}'` if [ ${tpid} ]; then echo 'Kill Process!' kill -9 $tpid else echo 'Stop Success!' fi tpid=`ps -ef|grep xjzd-lib-sys-0.0.1-SNAPSHOT.jar|grep -v grep|grep -v kill|awk '{print $2}'` if [ ${tpid} ]; then echo 'App is running.' else echo 'App is NOT running.' fi rm -f tpid #nohup java -jar ./$RESOURCE_NAME & nohup java -jar ./xjzd-lib-sys-0.0.1-SNAPSHOT.jar & echo $! > tpid echo Start Success!