美文网首页
Keepalived检测Nginx脚本

Keepalived检测Nginx脚本

作者: 闪灵之光 | 来源:发表于2017-05-25 11:20 被阅读0次

!/bin/bash

A=ps -C nginx --no-header | wc -l
if [ $A -eq 0 ];then
sleep 30 #睡眠30秒进行启动
/usr/local/nginx/sbin/nginx #尝试重新启动nginx
sleep 30 #睡眠30秒
if [ ps -C nginx --no-header | wc -l -eq 0 ];then
killall keepalived #启动失败,将keepalived服务杀死。将vip漂移到其它备份节点
fi
fi

相关文章

网友评论

      本文标题:Keepalived检测Nginx脚本

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