wryokom
1 Nickel

Capture Avamar backup exit status for use in postscript

Hello,

I have some very specific backups on some of my Linux servers that I need to know immediately if they succeeded or failed, and have the postscript take appropriate action.  Using the Avamar reports functionality is not acceptable for this, due to the sensitive nature of the data being backed up and other security rules I am forced to follow.  So what I need is a way for a postscript to find out the exit status of the backup that just ended and take action.  I've tried using the $? shell variable in the script, but it appears this is always zero as the postscript always processes the success path even if the backup failed.  Can anyone please help me find a simple answer?

FYI, this is an Avamar v6.0.2 environment, and the Linux server is a SuSE Enterprise 11.1 running v6.0.101-65 of the Avamar client.

Thank you,

Waide Yokom

0 Kudos
1 Reply
Highlighted
wryokom
1 Nickel

Re: Capture Avamar backup exit status for use in postscript

I scripted an answer to this myself.  It's not particularly clean or elegant, but it works.  I'll post the relevant pieces here for anyone else who might need it.

#!/bin/sh

BUADMIN="<insert email address of backup administrator>"

# Search for log file of current process in /var/avamar; "Infx" is part of Schedule or Group name

AVLOG=`ls -1tr /var/avamar | grep log | tail -2 | grep Infx`

AVLOG="/var/avamar"$AVLOG

# Check if errors exist in logfile; take action as appropriate

ERRSTR=`grep Error $AVLOG`

if [ -z "$ERRSTR" ]

then

# no errors found

mail -s"Prod Infx DB backup success" $BUADMIN

else

# errors found

mail -s"Prod Infx DB backup FAILED!" $BUADMIN

fi

Of course, I'd still be interested in a better solution if anyone has one.