當jar程序執行異常中斷時,希望系統能夠自動啟動。通過以下shell腳本監控程序一直運行。
#/bin/bash while true; do count=`ps -ef | grep test.jar | grep -v grep|wc -l` if [ ${count} -lt 1 ]; then nohup java -jar test.jar & else echo "process is running" fi sleep 3 done
當jar程序執行異常中斷時,希望系統能夠自動啟動。通過以下shell腳本監控程序一直運行。
#/bin/bash while true; do count=`ps -ef | grep test.jar | grep -v grep|wc -l` if [ ${count} -lt 1 ]; then nohup java -jar test.jar & else echo "process is running" fi sleep 3 done
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。