#!/bin/bash
while  :
do
nginxpid=`ps -C nginx --no-header | wc -l`
 if [ $nginxpid -gt 0 ];then
   echo "Nginx is still alive"
 else
   echo "Nginx is died"
   /etc/init.d/keepalived stop
 fi
sleep 5 
done