Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bperror script

Status
Not open for further replies.

qqqqqqqqqq1

Technical User
Joined
Oct 18, 2005
Messages
4
Location
US
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.
 
Please disregard this think I might have it. Thanks.
 
I was looking for something like this as well. How did you get this to work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top