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

https://blog.csdn.net/qq_27968607/article/details/60141007