当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删除。