自己編寫start.sh 和stop.sh
阿新 • • 發佈:2018-12-10
1.start.sh
#!/bin/bash PROJECTDIR=$(cd $(dirname $0)/..; pwd) #啟動服務,不列印任何資訊 #nohup `which java` -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:MaxNewSize=512m -Dfile-utf-8 -Dbasir=$PROJECTDIR -Djava.ext.dirs=./../lib:$JAVA-HOME/jre/lib/ext -cp ./../conf:./../lib/server-1.0.0.jar com.zdtech.platform.simserver.SimServer >/dev/null 2>&1 & #啟動服務,只打印錯誤日誌 nohup `which java` -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:MaxNewSize=512m -Dfile-utf-8 -Dbasir=$PROJECTDIR -Djava.ext.dirs=./../lib:$JAVA-HOME/jre/lib/ext -cp ./../conf:./../lib/server-1.0.0.jar com.zdtech.platform.simserver.SimServer >/dev/null 2>nohup.out & PID=$(pgrep -f "Dbasir=$PROJECTDIR") echo "PID:$PID" echo "啟動成功... .."
2.stop.sh
#!/bin/bash PROJECTDIR=$(cd $(dirname $0)/..; pwd) PID=$(pgrep -f "Dbasir=$PROJECTDIR") echo "PID: $PID" kill -9 $PID echo "停止成功... ..."