qqqqqqqqqq1
Technical User
Have this script and been working on the last part.
NETBACKUPDIR=/opt/netbackup/bin/admincmd
DATE=`date +%m/%d/%Y`
EMAIL=someone@somewhere.com
export NETBACKUPDIR DATE DATE2 EMAIL
export IFS="
"
${NETBACKUPDIR}/bperror -U -backstat -hoursago 12 | sort -r >errorout
echo "" >errormail
print "Subject: Backup Failures for $DATE" > errormail
echo "" >> errormail
head -n 1 errorout >> errormail
for LINE in `cat errorout`
do
stat=`echo $LINE | cut -b 1,2,3,4`
if [ "$stat" -ne 0 -a "$stat" -ne 1 ]
then
echo $LINE >>errormail
fi
done
/usr/sbin/sendmail -f server $EMAIL < errormail
which outputs an e-mail formatted like below:
STATUS CLIENT POLICY SCHED SERVER TIME COMPLETED
150 myserver SQLDBBCKUP Default-Ap server 10/18/2005 11:11:19
57 myserver1 SQL Cumulative server. 10/18/2005 04:10:09
57 myserver2 DominoLinux Cumulative server. 10/18/2005 04:07:35
6 myserver3 Informix Full_DB server10/18/2005 07:04:15
6 myserver4 Informix Full_DB server. 10/18/2005 07:04:09
Everything is working good except I can't seem to figure out a way to send to an e-mail group based on Status and Policy? So for example Status Code 57 would go to admin@admin.com if it was Domino Policy but if it was Status Code 57 with Policy SQL it would go to dba@admin.com.
I can change some things so that as an example if [ "$stat" -eq 150 ] || [ "$stat" -eq 57 ] || [ "$stat" -eq 86 ] and direct the e-mails that way but wasnt sure how to also include Policy as criteria. Any help would be great. Thanks.
NETBACKUPDIR=/opt/netbackup/bin/admincmd
DATE=`date +%m/%d/%Y`
EMAIL=someone@somewhere.com
export NETBACKUPDIR DATE DATE2 EMAIL
export IFS="
"
${NETBACKUPDIR}/bperror -U -backstat -hoursago 12 | sort -r >errorout
echo "" >errormail
print "Subject: Backup Failures for $DATE" > errormail
echo "" >> errormail
head -n 1 errorout >> errormail
for LINE in `cat errorout`
do
stat=`echo $LINE | cut -b 1,2,3,4`
if [ "$stat" -ne 0 -a "$stat" -ne 1 ]
then
echo $LINE >>errormail
fi
done
/usr/sbin/sendmail -f server $EMAIL < errormail
which outputs an e-mail formatted like below:
STATUS CLIENT POLICY SCHED SERVER TIME COMPLETED
150 myserver SQLDBBCKUP Default-Ap server 10/18/2005 11:11:19
57 myserver1 SQL Cumulative server. 10/18/2005 04:10:09
57 myserver2 DominoLinux Cumulative server. 10/18/2005 04:07:35
6 myserver3 Informix Full_DB server10/18/2005 07:04:15
6 myserver4 Informix Full_DB server. 10/18/2005 07:04:09
Everything is working good except I can't seem to figure out a way to send to an e-mail group based on Status and Policy? So for example Status Code 57 would go to admin@admin.com if it was Domino Policy but if it was Status Code 57 with Policy SQL it would go to dba@admin.com.
I can change some things so that as an example if [ "$stat" -eq 150 ] || [ "$stat" -eq 57 ] || [ "$stat" -eq 86 ] and direct the e-mails that way but wasnt sure how to also include Policy as criteria. Any help would be great. Thanks.