美文网首页
linux自启动脚本

linux自启动脚本

作者: 篱笆36 | 来源:发表于2019-07-17 15:46 被阅读0次
    #!/bin/sh
    
    while true
    
    do
    
    ps -ef | grep "test" | grep -v "grep"
    
    if [ "$?" -eq 1 ]
    
    then
    #需要启动的脚本
    ./test.sh
    
    echo "process has been restarted!"
    
    else
    
    echo "process already started!"
    
    fi
    #检查时间间隔10s
    sleep 10
    
    done
    
    

    相关文章

      网友评论

          本文标题:linux自启动脚本

          本文链接:https://www.haomeiwen.com/subject/abzqlctx.html