linux应用程序崩溃如何启动


2022-02-21 11:27:11 星期一

watchdog.sh
#!/bin/bash
while true
do
    ps -ef | grep "程序名" | grep -v "grep"
    if [ "$?" -eq 1 ]
        then
        ./run.sh #启动应用,修改成自己的启动应用脚本或命令
        echo "process has been restarted!"
    else
        echo "process already started!"
    fi
    sleep 10
done

2022-02-21 11:27:53 星期一


相关