Operating System - HP-UX
1850225 Members
3388 Online
104051 Solutions
New Discussion

Ignite backup script enhancement !!!

 
SOLVED
Go to solution
HP-UX_Ali
Regular Advisor

Ignite backup script enhancement !!!

Hello All

Required your assistance in script enhancement, we have more then 350+ HP servers and we manage the backup from ignite server. we have configured in each server in cron job after successfull backup or failure . mail should be sent to sysadmin group but as per our new requirement only failure of backups should be mailed to admin group...

Can any one suggest a smart script.

Thanks

Ali
6 REPLIES 6
Raj D.
Honored Contributor
Solution

Re: Ignite backup script enhancement !!!

ALI,
You can enhance the script with the failure condition , by checking the file/var/opt/ignite/recovery/latest/recovery.log

- Here is a sample given below:



#Executing Backup Script:
###########################################################
EMAIL=youremail@domain.com
DRIVE=/dev/rmt/0mn
echo "------ Starting Time:`date` ------" >> ${LOGFILE} 2>&1
echo " "
echo "Ignite (tape) Backup STARTED: `hostname` : `date`" | mailx -s "Ignite Backup STARTED: `hostname` : `date`" $EMAIL

/opt/ignite/bin/make_tape_recovery -x inc_entire=vg00 -I -v -a ${DRIVE} >>${LOGFILE} 2>&1



### Success_failure_check & Email:
tail ${LOGFILE} | grep -i unsuccess>/dev/null
if [ $? -eq 0 ]
then
echo " "| mailx -s "`hostname` :Ignite Backup FAILED!!! Please check!! " $EMAIL < ${LOGFILE}


else
echo " "| mailx -s "`hostname` :Ignite Backup Completed Successfully * * " $EMAIL < ${LOGFILE}
########




Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Jim Walls
Trusted Contributor

Re: Ignite backup script enhancement !!!


We do it this way...

/opt/ignite/bin/make_net_recovery -s ${ignitehost} -P s -A -x inc_entire=vg00 ${exclude} > ${logfile} 2>&1

res=$?

case ${res} in
0 ) echo "Success: Ignite Backup for ${thishost} completed"
;;
1 ) echo "Failed! Ignite Backup for ${thishost} reported an error"
/usr/bin/tail -20 ${logfile} | /usr/bin/mailx -s "Ignite Backup FAILED - ${thishost}" root sysadm@my.domain.com >/dev/null 2>&1
;;
* ) echo "Comment! Ignite Backup for ${thishost} reported a warning"
;;
esac


Because we run all our Ignite jobs via the cron, we get an email automatically from the cron reporting success/warning/failure we also get a copy of the tail-end of any failing Ignite log.


HP-UX_Ali
Regular Advisor

Re: Ignite backup script enhancement !!!

Thanks Raj & Jim,

If i Want only failed backups to be mailed to our mail account, Then i will be using below steps....pls confirm

tail ${LOGFILE} | grep -i unsuccess>/dev/null
if [ $? -eq 0 ]
then
echo " "| mailx -s "`hostname` :Ignite Backup FAILED!!! Please check!! " $EMAIL < ${LOGFILE}
fi

I dont want successful backup mail...

Regards
Ali

James R. Ferguson
Acclaimed Contributor

Re: Ignite backup script enhancement !!!

Hi Ali:

> I dont want successful backup mail...

Using Jim Walls' code (which leverages the return codes from 'make_tape_recovery', comment out (with a "#") the 'echo' statement for the case where the return code is zero. Otherwise, replace it with an 'exit' if appropriate.

Regards!

...JRF...
HP-UX_Ali
Regular Advisor

Re: Ignite backup script enhancement !!!

Thanks to all for the valuable inputs. I have checked both the scripts & working fine and achieved what i needed.


Thanks......... full marks to all of them.. :)

Regards
Ali
HP-UX_Ali
Regular Advisor

Re: Ignite backup script enhancement !!!

I have found the solution & hence closing the thread.