script to verify backup is succesfull or not

tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log
input datafile fno=00005 name=+ORA_DATA/jondb/datafile/users.264.696728295
input datafile fno=00003 name=+ORA_DATA/jondb/datafile/sysaux.261.696728281
input datafile fno=00001 name=+ORA_DATA/jondb/datafile/system.259.696728257
input datafile fno=00002 name=+ORA_DATA/jondb/datafile/undotbs1.260.696728279
input datafile fno=00004 name=+ORA_DATA/jondb/datafile/undotbs2.263.696728293
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 22-JUL-10
 
Recovery Manager complete.
RMAN BACKUP COMPLETED AT  Thu Jul 22 02:07:12 EST 2010
START CREATE TAR FILE AT  Thu Jul 22 02:07:12 EST 2010
START CLENUP OLD TAR FILE AT  Thu Jul 22 02:08:04 EST 2010
CLEAN UP OLD TAR FILE FINISHED AT  Thu Jul 22 02:08:04 EST 2010
execute backup transfer script... AT  Thu Jul 22 02:08:04 EST 2010
Transferring /RMANBKUP/apcnn01_JONDB_20100721020718.tar with  2.8G      /RMANBKUP/apcnn01_JONDB_20100721020718.tar to mcpnn01-public:/backup4/dailyapcalos/apcnn-RAC at Thu Jul 22 02:08:04 EST 2010...

I need to verify if the backup was success full or not can anyone give me idea how to write it.

tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log | awk -F ":" , { if backup set complete }'

I can not clearly see from the log how you decide if the backup was completely successful.
You could grep if you have any pattern like "fail" or "error" in the log. If yes, then send a mail or whatever.

Example:

grep -qiE "fail|error|incompl" your.log > /dev/null 2>&1 && echo "Sir, we have encountered a problem with the backup, sir." | mail -s "Backup failed" you@somedom.org
tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log |awk '/backup set complete/'
tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log |awk '/backup set complete/' 

should i use a if statement here awk '/backupset complete/' if ( how do i puit Gb in here)

# if [[ `tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log  | grep -w "backup set complete"` ]] ; then  
                   echo "Backup Complete"; 
              else 
                  echo "Backup Not Complete"; 
              fi
Backup Complete

awk '/backup set complete/' will output the line with "backup set complete", same as :

grep "backup set complete" urfile

sorry and thanks will use code tags from the next post i put in but anyway i didnt past exactly same messages from the server.

---------- Post updated at 07:50 PM ---------- Previous update was at 07:08 PM ----------

i need to even check the backup size how do it should be greater thar 2 do i awk

---------- Post updated at 07:50 PM ---------- Previous update was at 07:50 PM ----------

---------- Post updated 07-23-10 at 12:32 AM ---------- Previous update was 07-22-10 at 07:50 PM ----------

thank you for the prompt replies but i want to very two things in the above file and say that the backup is complete.one is size >2,other one is backup set complete how can i verify from the log above.