!/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