Home » Infrastructure » Unix » UNIX script to check archivelog backup (Any)
UNIX script to check archivelog backup [message #394123] Wed, 25 March 2009 14:57 Go to previous message
anjum.suri
Messages: 14
Registered: February 2008
Junior Member
Hi All

I am very new to programming/scripting so need some help from UNIX gurus; I need to write a script that check if the archivelog backup went successful or failed; I have written below script that goes to the directory where rman log files for archivelog backups resides and grab "Exit Status" from the archivelog from those files...now I am stuck with the IF part of the script (which I have commented) as in I want to print backup either succeded or failed based on the exit status...

I have multiple databases running on one machine; at the end I want a report to be emailed to me with details of which databases archivelog backups failed and for which they went successful

Could anyone please advice?


Script
------

chkbck ()
{
for i in `ls /ora/rman/logs/`;
do
ls -latr /ora/rman/logs/$i/b* | tail -1 | nawk '{ print $9 }';
done
}
for i in `chkbck`;
do
print $i
grep Exit $i
done > $TMP_FILE

#if egrep -i 'exit status [^0]' $TMP_FILE
#print "Backup Failed"
#fi


OUTPUT
--------

/ora/rman/scripts> cat chkbackup.tmp
/ora/rman/logs/DBADB1D/backup_DBADB1D_24Mar09-20:29:28.log
Exit Status 0
/ora/rman/logs/DBADB1P/backup_DBADB1P_24Mar09-19:41:48.log
Exit Status 0
/ora/rman/logs/DBADB2D/backup_DBADB2D_24Mar09-20:16:40.log
Exit Status 0
/ora/rman/logs/DBADB4D/backup_DBADB4D_05Jan09-16:09:39.log
Exit Status 0
/ora/rman/logs/DBADB7D/backup_DBADB7D_24Mar09-19:41:33.log
Exit Status 1
/ora/rman/logs/NO_SID/backup_arch_NO_SID_05Jan09-15:49:15.log
Exit Status 127
/ora/rman/logs/ORADB1P/backup_arch_ORADB1P_04Sep07-07:42:22.log
Exit Status 0
/ora/rman/logs/PAULTST/backup_PAULTST_19Jan09-23:53:03.log
Exit Status 1
/ora/rman/logs/PJ10G1D/backup_PJ10G1D_24Mar09-19:41:14.log
Exit Status 1
/ora/rman/logs/REMDY1X/backup_REMDY1X_04Dec08-22:04:41.log
Exit Status 1
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: unix shell script
Next Topic: FTP in UNIX Shell scripting
Goto Forum:
  


Current Time: Tue Mar 19 06:34:35 CDT 2024