The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UNIX script to check archivelog backups anjum.suri UNIX for Dummies Questions & Answers 1 03-25-2009 07:58 PM
IP Monitoring Script akhtar.bhat Shell Programming and Scripting 1 02-02-2009 05:03 AM
Monitoring Script manoj.solaris SUN Solaris 4 07-27-2007 08:27 AM
monitoring script gfhgfnhhn UNIX for Advanced & Expert Users 1 07-14-2006 12:10 PM
Job monitoring script Love High Level Programming 1 06-13-2006 09:56 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-23-2009
anjum.suri anjum.suri is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 8
Archivelog monitoring Script

Could anyone please help?

I have written a small program that's actually working fine for me and extracting all the details I required. What code does is, it goes to all archivelog directories and see if archivelog backup was failed or successful


Code:
<<CODE>>

TMP_FILE='/ora/rman/scripts/tmp_chk.log'

chkbck ()
{
for i in `ls /ora/rman/logs/`;
do
        find /ora/rman/logs/$i/backup_a*.log -mtime -1 2>/dev/null
done
}

for i in `chkbck`;
do
       print $i | cut -d"_" -f3
        print $i | cut -d"/" -f6
        egrep -i 'Starting backup*' $i
        egrep -i 'Finished backup*' $i

if egrep -i 'exit status [^0]' $i
then
        print "Backup Failed"
else
        print "Backup Successful"
fi


done > $TMP_FILE
<<CURRENT OUTPUT>>
ABC
backup_arch_ABC_22Apr09-155751.log
Starting backup at 22-APR-2009 15:57:58
Finished backup at 22-APR-2009 15:59:15
Backup Successful
XYZ
backup_arch_XYZ_22Apr09-160303.log
Starting backup at 22-APR-2009 16:03:15
Finished backup at 22-APR-2009 16:04:44
Backup Successful



Now, what I need is if I get this output in a email with proper headings and formatting.


<<DESIRED OUTPUT IN EMAIL>>


Database FileName Backup Start Backup End Status
--------- --------- ------------- ----------- -------

ABC backup_arch_ABC_22Apr09-155751.log 22-APR-2009 15:57:58 22-APR-2009 15:59:15 Backup Successful

XYZ backup_arch_XYZ_22Apr09-160303.log 22-APR-2009 16:03:15 22-APR-2009 16:04:44 Backup Successful

Could anyone please help me nicely formatting it?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0