- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help reqd for scripting
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 12:52 AM
10-09-2012 12:52 AM
Help reqd for scripting
Hi Dennis ,
My reqmnt is as follows;
a logfile gets generated at 9 pm say abc.log which contains a line ;
Start of shutcons
i want to capture RC codes for all jobs afetr this line , and it must fire a mail grepping RC other than zero codes , till i get a line given below in my dynamically generating log file ;
End of CI0251
Sample of abc.log file is afollows ;
Start of shutcons at Tue Sep 25 21:28:40 IST 2012
*** End of shutcons at Tue Sep 25 21:28:40 IST 2012 - RC = 0
*** Start of SY9600 at Tue Sep 25 21:29:05 IST 2012
*** End of SY9600 at Tue Sep 25 21:29:05 IST 2012 - RC = 0
*** Start of shutcons at Tue Sep 25 21:29:06 IST 2012
*** End of shutcons at Tue Sep 25 21:29:06 IST 2012 - RC = 0
*** Start of hksh0004 at Tue Sep 25 21:29:12 IST 2012
*** End of hksh0004 at Tue Sep 25 21:29:12 IST 2012 - RC = 0
*** Start of shutbtm at Tue Sep 25 21:29:19 IST 2012
*** End of shutbtm at Tue Sep 25 21:29:19 IST 2012 - RC = 0
*** Start of stopgateway at Tue Sep 25 21:29:37 IST 2012
*** End of stopgateway at Tue Sep 25 21:29:38 IST 2012 - RC = 0
*** Start of shutbtm at Tue Sep 25 21:29:40 IST 2012
*** End of shutbtm at Tue Sep 25 21:29:40 IST 2012 - RC = 0
*** Start of UTDEBUG1 at Tue Sep 25 21:29:41 IST 2012
*** End of UTDEBUG1 at Tue Sep 25 21:29:41 IST 2012 - RC = 0
*** Start of hkcheckdf at Tue Sep 25 21:29:43 IST 2012
*** End of hkcheckdf at Tue Sep 25 21:29:43 IST 2012 - RC = 0
*** Start of chkrerun at Tue Sep 25 21:29:47 IST 2012
*** End of chkrerun at Tue Sep 25 21:29:47 IST 2012 - RC = 0
*** Start of SY0007 at Tue Sep 25 21:29:53 IST 2012
*** End of SY0007 at Tue Sep 25 21:29:54 IST 2012 - RC = 0
*** Start of SY3100 at Tue Sep 25 21:30:12 IST 2012
*** End of SY3100 at Tue Sep 25 21:30:12 IST 2012 - RC = 0
*** Start of SP0100 at Tue Sep 25 21:30:13 IST 2012
*** End of SP0100 at Tue Sep 25 21:30:35 IST 2012 - RC = 0
*** Start of spms0122 at Tue Sep 25 21:30:36 IST 2012
*** End of spms0122 at Tue Sep 25 21:31:07 IST 2012 - RC = 0
*** Start of SY9507 at Tue Sep 25 21:31:08 IST 2012
*** End of SY9507 at Tue Sep 25 21:31:11 IST 2012 - RC = 0
*** Start of stopgateway at Tue Sep 25 21:31:16 IST 2012
*** End of stopgateway at Tue Sep 25 21:31:16 IST 2012 - RC = 0
*** Start of shutbtm at Tue Sep 25 21:31:17 IST 2012
*** End of shutbtm at Tue Sep 25 21:31:17 IST 2012 - RC = 0
*** Start of SY9600 at Tue Sep 25 21:31:18 IST 2012
*** End of SY9600 at Tue Sep 25 21:31:18 IST 2012 - RC = 0
*** Start of UTDEBUG1 at Tue Sep 25 21:31:19 IST 2012
*** End of UTDEBUG1 at Tue Sep 25 21:31:19 IST 2012 - RC = 0
*** Start of SY0007 at Tue Sep 25 21:31:27 IST 2012
*** End of SY0007 at Tue Sep 25 21:31:27 IST 2012 - RC = 04
*** Start of SY3300 at Tue Sep 25 21:31:47 IST 2012
*** End of SY3300 at Tue Sep 25 21:31:47 IST 2012 - RC = 0
*** Start of SY0199 at Tue Sep 25 21:31:56 IST 2012
*** End of SY0199 at Tue Sep 25 21:31:56 IST 2012 - RC = 254
End of CI0251
It must fire a mail saying job sy0199 RC = 254
It must fire a mail saying job sy0007 RC = 04 immediately as it comes in abc.log file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 07:21 PM - edited 10-10-2012 10:17 AM
10-09-2012 07:21 PM - edited 10-10-2012 10:17 AM
Re: Help reqd for scripting
awk '
/Start of shutcons/, /End of CI0251/ {
if ($2 == "End" && $3 == "of" && $NF != 0) {
# if RC != 0, print stop line
print "job", $4, $(NF-2), "=", $NF
}
} ' abc.log > failures.log
if [ -s failures.log ]; then
mailx -s "subject" zxcv@company.example < failures.log
fi
rm -f failures.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2012 01:07 AM
10-10-2012 01:07 AM
Re: Help reqd for scripting
Hi ,
Dennis ,
i tried the above script , but was not able to grep RC code 12 from the below lines;
*** Start of shutcons at Wed Oct 10 00:30:17 IST 2012
*** End of shutcons at Wed Oct 10 00:30:18 IST 2012 - RC = 0
*** End of SY0331 at Wed Oct 10 01:23:17 IST 2012 - RC = 0
*** Start of BR2490 at Wed Oct 10 01:23:23 IST 2012
*** End of BR2490 at Wed Oct 10 01:23:36 IST 2012 - RC = 0
*** Start of cfps0201 at Wed Oct 10 01:23:38 IST 2012
*** End of cfps0201 at Wed Oct 10 01:23:38 IST 2012 - RC = 0
*** Start of SY0201 at Wed Oct 10 01:23:39 IST 2012
*** End of SY0201 at Wed Oct 10 01:23:39 IST 2012 - RC = 12
*** Start of IN0787 at Wed Oct 10 01:23:40 IST 2012
*** End of IN0787 at Wed Oct 10 01:23:40 IST 2012 - RC = 0
*** Start of CI0251 at Wed Oct 10 01:23:43 IST 2012
*** End of CI0251 at Wed Oct 10 01:23:52 IST 2012 - RC = 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2012 10:18 AM
10-10-2012 10:18 AM
Re: Help reqd for scripting
>I tried the above script , but was not able to grep RC code 12 from the below lines;
*** Start of shutcons at Wed Oct 10 00:30:17 IST 2012
...
*** End of CI0251 at Wed Oct 10 01:23:52 IST 2012 - RC = 0
From your example file, I assumed that the start and ending strings didn't have leading "***". So change to:
/Start of shutcons/, /End of CI0251/ {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 05:00 AM
- « Previous
-
- 1
- 2
- Next »