服務監控腳本

#date:2019年9月12
#auth:jack_yd

#!/bin/bash
port=`netstat -anlpt | grep 5099 |awk '{print $4}'|cut -d: -f2`
if [ $port==5099 ] 
    then
    echo "Script run normal";
    else
         nohup  python /root/python/docker_deploy.py >/root/python/depolylog.txt 2>&1 &
    Testing_server;
fi

function Testing_server(){

     if [ $port!="" ]  
            then
            echo "Script run normal"
            else
             nohup  python /root/python/docker_deploy.py >/root/python/depolylog.txt 2>&1 &
     fi         

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章