stat=`cat hastat`
hareg=`cat hareg`
data=`date +"%Y%m%d"`
nodo=`hostname`
function spedisci_mail {
(
write the mail
echo "\
From: $mittente
To: $destinatari
Subject: $soggetto
MIME-Version: 1.0
Content-Type: text/plain;
"
echo "${contenuto}"
echo
) | /usr/lib/sendmail -t -f $mittente
}
mittente=monitor@mydomain
destinatari=pippo@mydomain
#soggetto="$nodo: Istanze KO in data $data"
flag=0
# Controllo istanza ora1
contenuto=`/opt/SUNWcluster/bin/hastat|egrep -e "ora1|ora2|appsrv|websrv"|tail -4|tr -d "\-"`
if [ "`echo "$contenuto"|grep ora1|grep running`" = "" ] ; then
flag=1
fi
# Controllo istanza ora2
if [ "`echo "$contenuto"|grep ora2|grep running`" = "" ] ; then
flag=1
fi
# Controllo istanza appsrv
if [ "`echo "$contenuto"|grep appsrv|grep running`" = "" ] ; then
flag=1
fi
# Controllo istanza websrv
if [ "`echo "$contenuto"|grep websrv|grep running`" = "" ] ; then
flag=1
fi
if [ $flag -eq 1 ] ; then
spedisci_mail
fi