美文网首页
keepalived+nginx HA检测脚本

keepalived+nginx HA检测脚本

作者: Seaofdesire | 来源:发表于2018-06-30 19:18 被阅读0次

https://www.cnblogs.com/coprince/p/6767548.html

#!/bin/bash
if [ "$(ps -ef | grep "nginx: master process"| grep -v grep )" == "" ]
then
     /home/NGINX/nginx/sbin/nginx
     sleep 5
     if [ "$(ps -ef | grep "nginx: master process"| grep -v grep )" == "" ]
     then
         killall keepalived
     fi
fi
#!/bin/bash
counter=$(ps -C nginx --no-heading|wc -l)
if [ "${counter}" = "0" ]; then
    /usr/local/bin/nginx
    sleep 2
    counter=$(ps -C nginx --no-heading|wc -l)
    if [ "${counter}" = "0" ]; then
        /etc/init.d/keepalived stop
    fi
fi

相关文章

网友评论

      本文标题:keepalived+nginx HA检测脚本

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