Hi All,
I need to check for 3 conditions and if all the 3 are not satified need to say that services are not running....
is the below code correct.
#********** Check to see if Service 1 is still running**************
if [ ser1 -eq 1 ]
then
echo "$datetimestamp: Service1 is not running" >> $LogPath"/"$LogName"
#exit 1
error_flag1=1
fi
#********** Check to see if Service 2 is still running**************
if [ file2 -eq 1 ]
then
echo "$datetimestamp: service2 is not running" >> $LogPath"/"$LogName
#exit 1
error_flag2=2
fi
#***********To check whether the service 3 is still running**********
if [ file3 -eq 1 ]
then
echo "$datetimestamp: service3 is not running" >> $LogPath"/"$LogName"
#exit 1
error_flag3=3
fi
if [[ $error_flag1 -eq 1 && $error_flag2 -eq 2 && $error_flag3 -eq 3 ]]
then
echo "Services are not running"
exit 1
fi