. /apps01/wls01/Oracle/Middleware/user_projects/domains/soadomain/bin/setDomainEnv.sh > /dev/null
cd /apps01/wls01/Oracle/Middleware/wlserver_10.3/common/bin
java weblogic.WLST ServerStatus.py > a.log
TEST=`cat a.log | grep WARN | wc -l`
if [ $TEST != 0 ]; then
`grep "WARN" a.log > 1.txt`
mail -s "$TEST ServersWarningMode`hostname`" xyz.mail.com < 1.txt
fi
A=soa_server1
B=bam_server1
c=AdminServer
TEST1=`cat a.log | grep soa_server1 | wc -l`
TEST2=`cat a.log | grep bam_server1 | wc -l`
TEST3=`cat a.log | grep AdminServer | wc -l`
if [ $TEST1 = 0 ]; then
`grep "soa_server1" a.log > 1.txt`
mail -s "$A is down, please check `hostname`" abc.mail.com
fi
if [ $TEST2 = 0 ]; then
`grep "bam_server1" a.log > 2.txt`
mail -s "$B is down, please check `hostname`" abc.mail.com
fi
if [ $TEST3 = 0 ]; then
`grep "AdminServer" a.log > 3.txt`
mail -s "$C is down, please check `hostname`" abc.mail.com
fi
Here i need the condition like if Two servers are down then only one mail is triggered not 2 mails. Whatever the no of servers are down, it should trigger only one mail.