cancel
Showing results for 
Search instead for 
Did you mean: 

backup_exit_notify script not working

Russell_Manaois
Level 4

Environment:  NBU 6.0MP4  Solaris 10

In November 2008, I modified the backup_exit_notify script to email Unix and Windows server admins of backup statuses other than 0 or 1.  The notifications had been working fine until the end of last month.  No changes have been made (as far as I know) to the backup or email environments.  I can send simple mail messages from the backup server using mailx, so this does not seem to be the problem.  I ran the backup_exit_notify script directly with test parameters and still no email notification.

Here is the modified code:

if [ "$5" -gt 1 ]; then # backup failed
if [ "$1" = "apollo" ]; then # notify DBAs
cat $OUTF | mailx -s "<SERVER> Backup Failure on CLIENT $1 STATUS $5" <list of Unix Admins>
else # notify Windows admin
cat $OUTF | mailx -s "<SERVER> Backup Failure on CLIENT $1 STATUS $5" <list of Windows Admins>
fi
fi

Any assistance is greatly appreciated.  Thank you.

--Russell

1 ACCEPTED SOLUTION

Accepted Solutions

Russell_Manaois
Level 4
Problem solved...incorrect syntax was used in the if conditional (missed spaces between brackets and conditional statement)...

if ["$5" -gt 1] ===> if [  "$5"  -gt  1  ]
                                                  

Thanks!

View solution in original post

3 REPLIES 3

scorpy_582
Level 6
Script looks ok to me and I dont see a reason why it should fail.
Some very basic things to debug scripts, which I would try.. May be you have already done

- Run it with -x to debug.
- Print out your variables at all steps.
- use exit status


Russell_Manaois
Level 4
Problem solved...incorrect syntax was used in the if conditional (missed spaces between brackets and conditional statement)...

if ["$5" -gt 1] ===> if [  "$5"  -gt  1  ]
                                                  

Thanks!

Will_Restore
Level 6
your original post has the correct spacing.