It's a shell script so the >, <, & = don't work as numeric comparitors. It
uses the old Fortran formats:
-gt is "greater than"
-lt is "less than"
-ge is "greater than or equal"
-le is "less than or equal"
-eq is "equal to"
If you want to compare two strings, the the "=" sign is used.
so, your comparison should be changed to:
if [ $5 -gt 1 ]
then
cat .....
fi
You might try something like this as more readable and uses less I/O to your
hard drive (the "EOF" at the bottom must start in column 1):
if [ $5 -gt 1 ]
then
cat<<EOF|mail -s "<big subject line>" rmajor AT vericenter DOT com
----------------------------------------
-- Date: `date` --
----------------------------------------
CLIENT: $1
POLICY: $2
SCHEDULE: $3
SCHEDULE TYPE: $4
STATUS: $5
STREAM: $6
----------------------------------------
ERROR: $5
`/usr/openv/netbackup/bin/admincmd/bperror -S $5`
----------------------------------------
EOF
fi
This could be your entire backup_exit_notify file and it should work OK.
-M
-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu]On Behalf Of Major, Rusty
Sent: Thursday, November 10, 2005 3:46 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Failed job notifications
I'm trying to get notifications on job failures ONLY and have added the
following to backup_exit_notify:
if [ $5 > 1 ]
then
cat $OUTF | mail -s "Backup of $1, Policy $2, Schedule $3 exited EC
$5" rmajor AT vericenter DOT com
fi
What I'm getting is an email for EVERY job in the following format:
Thu Nov 10 10:28:42 EST 2005 -----------------------------
Thu Nov 10 10:28:42 EST 2005 CLIENT: clientname
Thu Nov 10 10:28:42 EST 2005 POLICY: policyname
Thu Nov 10 10:28:43 EST 2005 SCHEDULE: Incremental
Thu Nov 10 10:28:43 EST 2005 SCHEDULE TYPE: INCR
Thu Nov 10 10:28:43 EST 2005 STATUS: 0
Thu Nov 10 10:28:43 EST 2005 STREAM: 0
Thu Nov 10 10:28:43 EST 2005 -----------------------------
I have received a few with the subject line, but the large majority do not
have it. I will admit I am not a perl guru (or unix for that matter) and
copied this from an older entry in the archives. I would appreciate any
help!
Rusty Major, MCSE, BCFP
Data Assurance Engineer
(281) 584-4693
VeriCenter, Inc.
|