#!/bin/bash
dateTime=`date +%Y-%m-%d_%H:%M:%S`
logFile=/var/log/keepalived/keepalived.log
failoverSh=/etc/keepalived/failover.sh
checkCmd=`systemctl status haproxy nginx salt-master salt-api salt-minion | grep 'active (running)' | wc -l`
if [ $checkCmd == '5' ];then
    echo "$dateTime All Services are Running." >> $logFile
    exit 0
else
    echo "$dateTime All Services are Not Running. Enter the next step." >> $logFile
    sh $failoverSh
    exit 1
fi
