Solved

How to get mksysb backup status for 500 servers in consolidated one file format?

Posted on 2014-04-29
19
395 Views
Last Modified: 2014-06-12
Currently in our backup script setup is that each mail will be send for one backup completion. So totally 500 indiviidual mail will come to mail box. I want to get all server backup status in single mail?  Could you help to get script for the same please? So that track of backup failure will be easy?
0
Comment
Question by:rammaghenthar
  • 11
  • 8
19 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40031452
Hi rammaghentharji, nice to meet you again!

You could use syslog to collect all your mksysb messages in a single file on a central syslog server.

Choose one of your AIX machines as the logging server. On this server, make sure that syslogd is neither started with "-r" nor "-R".
"ps -ef | grep syslogd" must show "/usr/sbin/syslogd" as the command, without any flags.
Choose a facility.level to use, I'd suggest "local0.info", but you are free to choose any facility except for "kern".

On the logging server add an entry like the following example to /etc/syslog.conf:

local0.info   /var/adm/mksysb.log

Add file rotation options, if desired.

Now, still on the logging server, issue "touch /var/adm/mksysb.log" and "refresh -s syslogd".

On the client machines add this to /etc/syslog.conf:

local0.info   @hostname_of_logging_server

and issue "refresh -s syslogd"

Replace "hostname_of_logging_server" with the actual network host name of the logging server.


Inside the backup scripts replace the call to "mail" with a call to "logger".

So instead of something like:

echo "Backup Completion Message" | mail -s "subject" rammaghenthar@domain.com

use

echo "Backup Completion Message" | logger -p local0.info


All the messages will be collected in the single file /var/adm/mksysb.log on the logging server.

You can mail this file to the desired user at convenient intervals. Don't forget to empty the file after sending it. Use e.g. "cat /dev/null > /var/adm/mksysb.log". Don't remove the logfile!

You can suppress the "Message forwarded from ..." part of the message header by starting the client syslog daemons with the "-n" flag.
If you need more assistance with this (or with other options like logfile rotation etc.) please let me know!


wmp
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40095632
Hi Woolmilkporkji,
            I apologies for late reply.  I am not allowed to change syslog setup in our environment. If you help me to get script for below description then it would be helpful.

all systems mksysb log files will be sitting here
system1:/opt/cargill/adm/logs/nim_mksysb
-rw-r--r--    1 root     system         1396 May 25 06:11 nim_mksysb-systemname1.log
-rw-r--r--    1 root     system         1158 May 26 07:00 nim_mksysb-systemname2.log
-rw-r--r--    1 root     system         1138 May 25 07:10 nim_mksysb-systemname3.log


I have pasted one model log output below . My requirement is a script  which will do following
1. print the date of the log file then take system name  from log file name
2. check inside the each log file and find out  "mksysb backup completed successfully" and then add the system name in a file say backup successfull or if not failed
3. The same step need to be followed all log files listed here and append the consolidate output and whole file needs to be sent to mail id/ids. Could you help on this please? I need to run this script from nim server where the log file resides.

system_nim1:/opt/cargill/adm/logs/nim_mksysb # cat nim_mksysb-systemname.log
Machine list is uxustnpr403

### Creating mksysb for uxustnpr403 ###
Sun May 25 06:00:00 CUT 2014
New file is uxustnpr403_mksysb_201405250600
Machine to backup is uxustnpr403

CSC Unix Team - Full Root Access
Contact ITSB-CS-UTS to renew.

Request accepted. All activities will be logged.


Creating information file (/image.data) for rootvg.

Creating list of files to back up

Backing up 115781 files..............................
59281 of 115781 files backed up (51%).......................

115781 of 115781 files backed up (100%)
0512-038 mksysb: Backup Completed Successfully.
Sun May 25 06:09:20 CUT 2014

CSC Unix Team - Full Root Access
Contact ITSB-CS-UTS to renew.

Request accepted. All activities will be logged.

system_nim:/opt/cargill/adm/logs/nim_mksysb #
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40096661
1) Do you actually need the creation date of the logfile? Wouldn't the date inside the log file do better? Or do you need the date which appears in the name of the logfile (e.g. "uxustnpr403_mksysb_201405250600")?

2) Similar to (1): Do you actually need the system name to be derived from the logfile's name? Wouldn't the name of the "Machine to backup" as seen inside the log file do better?

3) Do you need two distinct output files, one for "Successful" and one for "Failed" backups, or do you want to receive a single file containing e.g.

May 25, 2014 systemname1 Backup Successful
May 26, 2014 systemname2 Backup Failed
  ?

I didn't understand your requirement very well in this case.
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40098068
1. I need date appears in the name of the logfile.
2.  the name of the "Machine to backup" as seen inside the log file is ok
3.  I want to receive a single file containing  both successful and failed backup.

In simple wards  the script will need to provide all system backup status in single file Instead of getting one file/system.
Hope this is clear
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40098082
In other wards the script need to collect the backup information from all individual log files consolidate it and send to us in mail
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40098659
OK.

I'll assume that the real filenames are of the form "machinename_mksysb_YYYYMMDDhhmm" as printed inside the logs, instead of "nim_mksysb-systemname1.log" as posted in your question.
Please let me know if this assumption is incorrect!

Should we sort the ouput one way or the other? For the moment I'll take the default order as obtained from "ls".

Anyway, here we go:

#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT="/tmp/mksysb_summary"
MAILTO="recipient1@domain1.tld recipient2@domain2.tld recipient3@domain3.tld"

for LOG in $DIR/*_mksysb_*
  do
    DATE=$(echo $LOG | awk -F'mksysb_' '{print substr($2,1,4) "-" substr($2,5,2) "-" substr($2,7,2), substr($2,9,2) ":" substr($2,11,2)}')
    MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
    grep -q "0512-038 mksysb: Backup Completed Successfully." $LOG && STATE="Backup Successful" || STATE="Backup Failed!"
    echo $DATE $MACHINE $STATE
  done > $OUT
mailx -s "MKSYSB Summary from NIM Server $(hostname)" $MAILTO < $OUT
rm $OUT

Open in new window

Don't forget to customize the recipient list (MAILTO variable).

By the way, shouldn't we delete or rename the logfiles once they've been processed?
Otherwise the script will process them again during its next run.
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40101334
HI Woolmilkporkji,
           Real log file name is nim_mksysb-systemname1.log .
mksysb file name  machinename_mksysb_YYYYMMDDhhmm ( which is situated inside the log). May i request script accordingly please?
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40101337
Modify script accordingly please?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40101543
You wrote >> Real log file name is nim_mksysb-systemname1.log <<

OK then, but you also wrote in a previous comment  >>  I need date appears in the name of the logfile. <<

I don't see any date there! But OK, I'll take the logfile's last modification date instead.

Here we go again:

#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT="/tmp/mksysb_summary"
MAILTO="recipient1@domain1.tld recipient2@domain2.tld recipient3@domain3.tld"

for LOG in $DIR/*.log
  do
    DATE=$(istat $LOG | awk -F'ied:\t' '/Last modified:/ {print substr($2,5)}')
    MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
    grep -q "0512-038 mksysb: Backup Completed Successfully." $LOG && STATE="Backup Successful" || STATE="Backup Failed!"
    echo $DATE $MACHINE $STATE
  done > $OUT
mailx -s "MKSYSB Summary from NIM Server $(hostname)" $MAILTO < $OUT
rm $OUT

Open in new window

Note: The date/time stamp now has the form e.g. "May 30 19:58:57 CUT 2014"
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 2

Author Comment

by:rammaghenthar
ID: 40101683
Hi Woolmilkporkji

Script working fine. output erratic I want one system output to come on one line. could you help where I missed it here?

like below - Why successfull output coming with failed one. Please help?
           
Sep 9 19:36:32 2013 Backup Failed!
Jul 20 00:17:08 2013 master Backup Failed!
May 30 01:16:52 2014 ndoclp01 Backup Successful May 30 16:07:35 2014 ndwwdc06 Backup Failed!
May 30 01:09:27 2014 ndwwlp05 Backup Successful May 8 11:46:33 2011 uxuselkg012 Backup Failed!
May 24 00:10:32 2014 uvuselkg011 Backup Failed!
May 24 00:10:33 2014 uvuselkg012 Backup Failed!
May 24 00:14:23 2014 uvuselkg013 Backup Failed!
May 24 00:18:41 2014 uvuselkg014 Backup Failed!
May 24 01:14:17 2014 uvuselkg015 Backup Failed!
May 24 01:07:52 2014 uvuselkg016 Backup Failed!
May 24 01:00:13 2014 uvuselkg017 Backup Failed!
May 24 01:13:35 2014 uvuselkg018 Backup Failed!
May 24 04:31:09 2014 uvuselkg01A Backup Failed!
May 24 04:27:57 2014 uvuselkg01B Backup Failed!
Jan 25 01:00:01 2014 uvuselkg01a Backup Failed!
Jan 25 02:00:02 2014 uvuselkg01b Backup Failed!
May 24 02:16:37 2014 uvuselkg021 Backup Failed!
May 24 02:16:22 2014 uvuselkg022 Backup Failed!
May 24 02:17:53 2014 uvuselkg023 Backup Failed!
May 24 02:14:26 2014 uvuselkg024 Backup Failed!
May 24 03:00:03 2014 uvuselkg025 Backup Failed!
May 24 03:00:03 2014 uvuselkg026 Backup Failed!
May 24 03:13:49 2014 uvuselkg027 Backup Failed!
May 24 03:13:27 2014 uvuselkg028 Backup Failed!
May 24 05:21:19 2014 uvuselkg02A Backup Failed!
May 24 05:20:07 2014 uvuselkg02B Backup Failed!
Jan 25 03:00:02 2014 uvuselkg02a Backup Failed!
Jan 25 04:00:01 2014 uvuselkg02b Backup Failed!
Jan 25 21:00:03 2014 uvuselkg041 Backup Failed!
Jan 25 21:06:59 2014 uvuselkg042 Backup Failed!
Jan 25 22:00:01 2014 uvuselkg043 Backup Failed!
Jan 25 22:00:01 2014 uvuselkg044 Backup Failed!
Jan 25 22:00:01 2014 uvuselkg045 Backup Failed!
Jan 25 22:00:01 2014 uvuselkg046 Backup Failed!
May 24 04:28:32 2014 uvuselkg051 Backup Failed!
May 24 04:30:03 2014 uvuselkg052 Backup Failed!
May 24 22:10:29 2014 uvuselkg061 Backup Failed!
May 24 23:10:44 2014 uvuselkg062 Backup Failed!
May 24 23:16:05 2014 uvuselkg071 Backup Failed!
May 24 23:17:09 2014 uvuselkg072 Backup Failed!
May 24 20:19:37 2014 uvuselkg101 Backup Failed!
May 24 20:24:59 2014 uvuselkg102 Backup Failed!
May 24 20:26:09 2014 uvuselkg103 Backup Failed!
May 24 20:14:02 2014 uvuselkg104 Backup Failed!
May 24 20:24:31 2014 uvuselkg105 Backup Failed!
May 24 21:19:55 2014 uvuselkg106 Backup Failed!
May 24 21:11:34 2014 uvuselkg107 Backup Failed!
May 24 21:17:43 2014 uvuselkg108 Backup Failed!
May 24 23:17:05 2014 uvuselkg111 Backup Failed!
May 24 23:17:07 2014 uvuselkg112 Backup Failed!
May 30 04:07:27 2014 uxuselkg011 Backup Successful May 30 04:12:13 2014 uxuselkg012 Backup Successful May 30 04:07:11 2014 uxuselkg013 Backup Successful May 30 05:08:32 2014 uxuselkg014 Backup Successful May 30 05:08:54 2014 uxuselkg015 Backup Failed!
May 30 05:10:16 2014 uxuselkg017 Backup Failed!
May 30 05:09:38 2014 uxuselkg018 Backup Successful May 30 05:09:48 2014 uxuselkg019 Backup Successful May 30 06:09:29 2014 uxuselkg026 Backup Failed!
May 30 02:06:19 2014 uxuselkg108 Backup Successful May 30 03:11:07 2014 uxuselkg109 Backup Successful May 23 03:00:00 2014 uxuselkg129 Backup Failed!
May 23 03:00:01 2014 uxuselkg130 Backup Failed!
May 23 03:00:01 2014 uxuselkg131 Backup Failed!
Apr 18 03:00:00 2014 uxuselkg132 Backup Failed!
Apr 18 04:00:01 2014 uxuselkg133 Backup Failed!
Apr 18 04:00:01 2014 uxuselkg134 Backup Failed!
May 30 06:25:54 2014 uxuselkg920 Backup Successful May 30 06:31:13 2014 uxuselkg921 Backup Successful May 30 06:24:46 2014 uxuselkg922 Backup Successful May 30 06:13:09 2014 uxuselkg923 Backup Successful May 23 23:18:27 2014 uxusminn001 Backup Successful May 30 00:08:39 2014 uxusminn003 Backup Successful May 23 23:09:41 2014 uxusminn016 Backup Successful May 23 23:09:39 2014 uxusminn028 Backup Successful May 23 22:13:35 2014 uxusminn040 Backup Successful May 23 22:12:04 2014 uxusminn041 Backup Successful May 23 23:11:52 2014 uxusminn042 Backup Successful May 23 23:08:41 2014 uxusminn043 Backup Successful May 30 00:10:29 2014 uxusminn045 Backup Successful May 28 07:14:35 2014 uxustnat001 Backup Successful May 28 07:14:05 2014 uxustnat002 Backup Successful May 28 07:13:19 2014 uxustnat401 Backup Successful May 28 07:12:28 2014 uxustnat402 Backup Successful May 28 07:11:14 2014 uxustnat403 Backup Successful May 28 08:35:31 2014 uxustnat901 Backup Successful May 28 08:14:01 2014 uxustnd1001 Backup Failed!
May 28 08:13:54 2014 uxustnd1002 Backup Successful May 28 08:11:11 2014 uxustnd1401 Backup Successful May 28 08:13:53 2014 uxustnd1402 Backup Successful May 29 20:10:53 2014 uxustnd1403 Backup Successful May 29 20:17:07 2014 uxustnd1901 Backup Successful May 29 20:14:39 2014 uxustnd2001 Backup Successful May 29 20:16:10 2014 uxustnd2002 Backup Successful May 29 20:16:29 2014 uxustnd2401 Backup Successful May 29 21:16:14 2014 uxustnd2402 Backup Successful May 29 21:17:02 2014 uxustnd2403 Backup Successful May 29 21:16:15 2014 uxustnd2901 Backup Failed!
May 29 21:13:23 2014 uxustnd3001 Backup Successful May 29 21:15:03 2014 uxustnd3002 Backup Failed!
May 29 22:12:56 2014 uxustnd3401 Backup Successful May 29 22:13:24 2014 uxustnd3402 Backup Successful May 29 22:13:40 2014 uxustnd3403 Backup Successful May 29 22:16:28 2014 uxustnd3901 Backup Successful Feb 2 19:10:00 2013 uxustnd_103 Backup Failed!
Feb 2 20:10:00 2013 uxustnd_104 Backup Failed!
Feb 2 21:10:00 2013 uxustnd_105 Backup Failed!
Feb 2 22:10:00 2013 uxustnd_106 Backup Failed!
Feb 2 03:10:00 2013 uxustnd_110 Backup Failed!
Nov 3 16:11:17 2012 uxustndv001 Backup Failed!
May 23 21:09:48 2014 uxustndv002 Backup Successful Nov 3 18:11:15 2012 uxustndv102 Backup Failed!
Aug 6 23:41:17 2011 uxustndv107 Backup Failed!
Aug 6 01:41:16 2011 uxustndv108 Backup Failed!
May 23 22:12:18 2014 uxustndv109 Backup Successful May 23 22:10:33 2014 uxustndv111 Backup Successful Aug 6 18:11:16 2011 uxustndv112 Backup Failed!
Aug 6 19:11:16 2011 uxustndv113 Backup Failed!
Apr 2 20:11:16 2011 uxustndv114 Backup Failed!
Apr 2 21:11:16 2011 uxustndv115 Backup Failed!
Aug 6 22:11:15 2011 uxustndv116 Backup Failed!
Nov 6 14:11:17 2011 uxustndv117 Backup Failed!
Nov 4 13:11:16 2011 uxustndv118 Backup Failed!
Aug 5 14:11:16 2011 uxustndv119 Backup Failed!
Jun 4 23:11:16 2011 uxustndv120 Backup Failed!
Jan 24 22:00:01 2014 uxustndv301 Backup Failed!
May 4 02:25:00 2013 uxustndv302 Backup Failed!
Aug 6 01:41:16 2011 uxustndv319 Backup Failed!
May 30 06:07:10 2014 uxustndv501 Backup Successful May 30 06:08:52 2014 uxustndv502 Backup Successful May 30 07:09:56 2014 uxustndv503 Backup Successful May 30 07:11:10 2014 uxustndv901 Backup Successful May 29 02:14:11 2014 uxustnlb001 Backup Failed!
May 28 06:14:50 2014 uxustnlb002 Backup Failed!
May 29 02:12:05 2014 uxustnlb101 Backup Failed!
May 28 06:10:51 2014 uxustnlb102 Backup Failed!
May 29 02:17:11 2014 uxustnlb901 Backup Successful May 28 06:13:28 2014 uxustnlb902 Backup Successful Aug 5 01:22:55 2013 uxustnme001 Backup Successful May 30 07:32:42 2014 uxustnme002 Backup Successful May 29 02:08:43 2014 uxustnme003 Backup Successful May 28 06:11:55 2014 uxustnme004 Backup Successful Jul 20 10:50:59 2013 uxustnme005 Backup Failed!
May 29 22:15:28 2014 uxustnme010 Backup Successful May 29 02:08:00 2014 uxustnms001 Backup Successful May 28 06:07:46 2014 uxustnms002 Backup Successful Jul 18 11:20:13 2013 uxustnms003 Backup Successful May 30 07:08:33 2014 uxustnms004 Backup Successful May 29 23:22:14 2014 uxustnms005 Backup Failed!
May 29 23:19:15 2014 uxustnnd101 Backup Failed!
May 29 23:20:40 2014 uxustnnd102 Backup Failed!
May 29 23:20:05 2014 uxustnnd103 Backup Failed!
May 29 23:15:28 2014 uxustnnd104 Backup Failed!
May 29 00:17:51 2014 uxustnnd105 Backup Successful May 29 00:18:09 2014 uxustnnd106 Backup Successful May 29 00:15:03 2014 uxustnnd107 Backup Failed!
May 29 00:16:24 2014 uxustnnd108 Backup Successful May 26 08:08:57 2014 uxustnnm001 Backup Successful May 29 00:19:00 2014 uxustnnp910 Backup Failed!
May 25 20:10:33 2014 uxustnpr001 Backup Failed!
May 25 08:22:09 2014 uxustnpr002 Backup Successful May 25 20:17:48 2014 uxustnpr003 Backup Successful May 25 08:15:42 2014 uxustnpr004 Backup Successful May 25 20:02:48 2014 uxustnpr101 Backup Successful May 25 20:02:43 2014 uxustnpr102 Backup Successful May 25 20:06:51 2014 uxustnpr103 Backup Successful May 25 21:08:31 2014 uxustnpr104 Backup Successful May 25 21:03:54 2014 uxustnpr105 Backup Successful May 25 21:07:18 2014 uxustnpr106 Backup Successful May 25 21:07:54 2014 uxustnpr107 Backup Successful May 25 21:07:34 2014 uxustnpr108 Backup Successful May 25 22:00:30 2014 uxustnpr109 Backup Failed!
May 25 22:00:30 2014 uxustnpr110 Backup Failed!
May 25 22:00:30 2014 uxustnpr111 Backup Failed!
May 25 22:00:30 2014 uxustnpr112 Backup Failed!
May 25 22:00:30 2014 uxustnpr113 Backup Failed!
May 25 23:00:31 2014 uxustnpr114 Backup Failed!
May 25 23:00:31 2014 uxustnpr115 Backup Failed!
May 25 23:00:31 2014 uxustnpr116 Backup Failed!
May 25 23:00:33 2014 uxustnpr117 Backup Failed!
May 25 23:00:31 2014 uxustnpr118 Backup Failed!
May 25 00:10:13 2014 uxustnpr119 Backup Successful May 25 00:11:01 2014 uxustnpr120 Backup Failed!
May 25 00:10:03 2014 uxustnpr121 Backup Failed!
May 25 00:09:23 2014 uxustnpr122 Backup Failed!
May 25 00:09:05 2014 uxustnpr124 Backup Successful May 26 08:07:35 2014 uxustnpr125 Backup Successful May 26 08:09:26 2014 uxustnpr126 Backup Successful May 26 08:11:06 2014 uxustnpr127 Backup Successful May 26 08:08:53 2014 uxustnpr128 Backup Successful May 26 08:08:47 2014 uxustnpr129 Backup Successful May 25 08:08:29 2014 uxustnpr130 Backup Successful May 25 08:08:07 2014 uxustnpr131 Backup Successful May 26 20:02:32 2014 uxustnpr132 Backup Successful May 26 20:02:24 2014 uxustnpr133 Backup Successful May 26 20:05:41 2014 uxustnpr134 Backup Successful May 26 20:06:04 2014 uxustnpr135 Backup Successful May 26 20:06:01 2014 uxustnpr136 Backup Successful May 26 21:06:16 2014 uxustnpr137 Backup Successful May 26 21:05:43 2014 uxustnpr138 Backup Successful May 26 21:05:52 2014 uxustnpr139 Backup Successful May 26 21:06:03 2014 uxustnpr140 Backup Successful May 26 21:06:14 2014 uxustnpr141 Backup Successful May 26 22:02:38 2014 uxustnpr142 Backup Failed!
May 26 22:02:37 2014 uxustnpr143 Backup Failed!
May 26 22:02:38 2014 uxustnpr144 Backup Failed!
May 26 22:02:36 2014 uxustnpr145 Backup Failed!
May 26 22:02:39 2014 uxustnpr146 Backup Failed!
May 26 23:02:44 2014 uxustnpr147 Backup Failed!
May 26 23:02:46 2014 uxustnpr148 Backup Failed!
May 26 23:02:44 2014 uxustnpr149 Backup Failed!
May 26 23:02:45 2014 uxustnpr150 Backup Failed!
May 26 23:02:47 2014 uxustnpr151 Backup Failed!
May 26 00:00:31 2014 uxustnpr152 Backup Failed!
May 26 00:00:31 2014 uxustnpr153 Backup Failed!
May 26 00:00:31 2014 uxustnpr155 Backup Failed!
May 26 00:00:31 2014 uxustnpr156 Backup Failed!
May 26 00:00:31 2014 uxustnpr157 Backup Failed!
May 26 01:00:33 2014 uxustnpr158 Backup Failed!
May 25 01:04:21 2014 uxustnpr159 Backup Successful May 26 01:00:33 2014 uxustnpr160 Backup Failed!
May 26 08:09:10 2014 uxustnpr161 Backup Successful May 26 01:00:33 2014 uxustnpr162 Backup Failed!
May 25 01:09:41 2014 uxustnpr163 Backup Successful May 26 01:00:33 2014 uxustnpr164 Backup Failed!
May 25 01:10:54 2014 uxustnpr165 Backup Successful May 26 01:00:33 2014 uxustnpr166 Backup Failed!
May 25 01:11:43 2014 uxustnpr167 Backup Successful May 26 02:00:39 2014 uxustnpr168 Backup Failed!
May 25 02:04:23 2014 uxustnpr169 Backup Successful May 26 02:00:39 2014 uxustnpr170 Backup Failed!
May 25 02:04:31 2014 uxustnpr171 Backup Successful May 26 02:00:39 2014 uxustnpr172 Backup Failed!
May 25 02:10:44 2014 uxustnpr173 Backup Successful May 26 02:00:39 2014 uxustnpr174 Backup Failed!
May 25 02:10:41 2014 uxustnpr175 Backup Successful May 26 02:00:39 2014 uxustnpr176 Backup Failed!
May 25 02:11:02 2014 uxustnpr177 Backup Successful May 26 03:00:37 2014 uxustnpr178 Backup Failed!
May 25 03:10:05 2014 uxustnpr185 Backup Successful May 26 03:00:37 2014 uxustnpr180 Backup Failed!
May 25 03:08:14 2014 uxustnpr181 Backup Successful May 26 03:00:37 2014 uxustnpr182 Backup Failed!
May 25 03:03:42 2014 uxustnpr183 Backup Successful May 26 03:00:37 2014 uxustnpr184 Backup Failed!
May 26 03:00:37 2014 uxustnpr186 Backup Failed!
May 26 04:00:30 2014 uxustnpr188 Backup Failed!
May 25 04:02:25 2014 uxustnpr189 Backup Successful May 26 04:00:30 2014 uxustnpr190 Backup Failed!
May 25 04:06:46 2014 uxustnpr191 Backup Successful May 26 04:00:30 2014 uxustnpr192 Backup Failed!
May 25 04:06:35 2014 uxustnpr193 Backup Successful May 26 04:00:30 2014 uxustnpr194 Backup Failed!
May 26 00:10:34 2014 uxustnpr195 Backup Failed!
May 27 00:12:25 2014 uxustnpr196 Backup Successful May 28 00:12:37 2014 uxustnpr197 Backup Successful May 29 00:14:02 2014 uxustnpr198 Backup Successful May 30 00:18:47 2014 uxustnpr199 Backup Successful May 24 00:19:42 2014 uxustnpr200 Backup Successful May 25 04:08:39 2014 uxustnpr301 Backup Successful May 27 00:15:41 2014 uxustnpr302 Backup Failed!
Dec 12 22:30:00 2013 uxustnpr303 Backup Failed!
May 6 05:30:00 2013 uxustnpr304 Backup Failed!
Dec 12 23:30:00 2013 uxustnpr305 Backup Failed!
May 6 05:50:00 2013 uxustnpr306 Backup Failed!
May 6 06:00:00 2013 uxustnpr307 Backup Failed!
May 6 06:10:00 2013 uxustnpr308 Backup Failed!
Dec 13 01:30:00 2013 uxustnpr309 Backup Failed!
Jul 15 15:50:32 2013 uxustnpr310 Backup Failed!
Dec 13 02:30:00 2013 uxustnpr311 Backup Failed!
May 25 04:12:44 2014 uxustnpr312 Backup Successful May 25 05:13:45 2014 uxustnpr313 Backup Successful May 25 05:15:57 2014 uxustnpr314 Backup Successful May 25 05:11:17 2014 uxustnpr315 Backup Successful Apr 4 07:31:15 2011 uxustnpr316 Backup Failed!
May 25 05:15:01 2014 uxustnpr317 Backup Successful May 25 05:02:17 2014 uxustnpr318 Backup Successful May 26 04:01:19 2014 uxustnpr319 Backup Failed!
May 26 05:00:33 2014 uxustnpr320 Backup Failed!
Dec 13 01:50:00 2013 uxustnpr321 Backup Failed!
Feb 25 18:13:58 2013 uxustnpr322 Backup Successful Dec 13 02:50:00 2013 uxustnpr323 Backup Failed!
Feb 25 18:52:18 2013 uxustnpr324 Backup Successful Feb 25 19:00:03 2013 uxustnpr325 Backup Successful Feb 25 16:14:55 2013 uxustnpr326 Backup Failed!
Dec 13 03:50:00 2013 uxustnpr327 Backup Failed!
Jul 15 22:39:33 2013 uxustnpr328 Backup Failed!
Dec 13 04:50:00 2013 uxustnpr329 Backup Failed!
May 26 07:01:26 2014 uxustnpr330 Backup Failed!
May 26 05:00:33 2014 uxustnpr331 Backup Failed!
May 26 05:00:33 2014 uxustnpr332 Backup Failed!
May 26 05:00:33 2014 uxustnpr333 Backup Failed!
Apr 5 22:30:34 2011 uxustnpr334 Backup Failed!
May 26 05:00:36 2014 uxustnpr335 Backup Failed!
May 26 06:00:34 2014 uxustnpr336 Backup Failed!
Dec 13 22:30:00 2013 uxustnpr337 Backup Failed!
Dec 14 01:50:01 2013 uxustnpr338 Backup Failed!
Jun 1 06:50:00 2013 uxustnpr339 Backup Failed!
May 4 07:10:01 2013 uxustnpr340 Backup Failed!
May 25 06:11:10 2014 uxustnpr401 Backup Successful May 26 06:00:34 2014 uxustnpr402 Backup Failed!
May 25 06:09:20 2014 uxustnpr403 Backup Successful May 26 06:00:34 2014 uxustnpr404 Backup Failed!
May 6 08:30:00 2013 uxustnpr405 Backup Failed!
Feb 4 18:00:00 2013 uxustnpr406 Backup Failed!
May 25 06:10:55 2014 uxustnpr407 Backup Successful May 26 06:00:34 2014 uxustnpr408 Backup Failed!
May 25 06:10:17 2014 uxustnpr501 Backup Successful May 26 06:00:34 2014 uxustnpr502 Backup Failed!
May 25 06:11:02 2014 uxustnpr503 Backup Failed!
May 26 07:00:39 2014 uxustnpr504 Backup Failed!
May 25 07:10:52 2014 uxustnpr505 Backup Successful May 26 07:00:44 2014 uxustnpr506 Backup Failed!
May 25 07:08:17 2014 uxustnpr507 Backup Failed!
May 26 06:00:34 2014 uxustnpr508 Backup Failed!
May 25 03:02:35 2014 uxustnpr187 Backup Successful May 25 07:12:27 2014 uxustnpr901 Backup Successful May 26 07:00:39 2014 uxustnpr902 Backup Failed!
May 25 07:13:19 2014 uxustnpr903 Backup Successful May 26 07:00:40 2014 uxustnpr904 Backup Failed!
May 25 07:12:52 2014 uxustnpr905 Backup Successful May 26 07:00:39 2014 uxustnpr906 Backup Failed!
Dec 14 22:30:01 2013 uxustnpr907 Backup Failed!
Dec 14 22:50:00 2013 uxustnpr908 Backup Failed!
May 25 08:15:03 2014 uxustnpr909 Backup Successful May 26 07:00:39 2014 uxustnpr910 Backup Failed!
Feb 25 12:13:00 2011 uxustnps001 Backup Successful Oct 20 10:10:00 2009 uxustnps102 Backup Failed!
Oct 21 10:10:00 2009 uxustnps333 Backup Failed!
Oct 20 10:40:00 2009 uxustnps401 Backup Failed!
Oct 20 11:10:01 2009 uxustnps403 Backup Failed!
Oct 21 11:10:01 2009 uxustnps902 Backup Failed!
May 29 01:16:19 2014 uxustnq1001 Backup Successful May 29 01:16:17 2014 uxustnq1002 Backup Successful May 29 01:13:42 2014 uxustnq1401 Backup Successful May 29 01:16:05 2014 uxustnq1402 Backup Successful May 29 01:14:07 2014 uxustnq1403 Backup Successful May 29 01:17:06 2014 uxustnq1901 Backup Successful May 29 03:20:42 2014 uxustnq2001 Backup Successful May 29 03:17:00 2014 uxustnq2002 Backup Successful May 29 03:13:50 2014 uxustnq2401 Backup Successful May 29 03:17:13 2014 uxustnq2402 Backup Successful May 29 03:16:51 2014 uxustnq2403 Backup Successful May 29 04:26:55 2014 uxustnq2901 Backup Successful May 29 04:15:31 2014 uxustnq3001 Backup Successful May 29 04:13:56 2014 uxustnq3002 Backup Successful May 29 04:12:02 2014 uxustnq3401 Backup Successful May 29 04:15:40 2014 uxustnq3402 Backup Successful May 30 05:10:53 2014 uxustnq3403 Backup Successful May 30 05:26:02 2014 uxustnq3901 Backup Successful May 30 05:19:57 2014 uxustnq4001 Backup Successful May 30 05:14:49 2014 uxustnq4002 Backup Successful May 30 05:11:58 2014 uxustnq4401 Backup Successful May 30 06:14:27 2014 uxustnq4402 Backup Successful May 30 06:14:01 2014 uxustnq4403 Backup Successful May 30 06:20:23 2014 uxustnq4901 Backup Successful May 30 07:06:26 2014 uxustnqa001 Backup Successful May 30 08:09:02 2014 uxustnqa002 Backup Successful May 21 02:11:16 2011 uxustnqa101 Backup Failed!
May 21 03:11:16 2011 uxustnqa102 Backup Failed!
May 21 04:11:15 2011 uxustnqa103 Backup Failed!
Aug 6 05:11:16 2011 uxustnqa104 Backup Failed!
Aug 6 06:11:16 2011 uxustnqa105 Backup Failed!
Aug 6 07:11:16 2011 uxustnqa106 Backup Failed!
Aug 6 08:11:17 2011 uxustnqa107 Backup Failed!
May 30 08:05:44 2014 uxustnqa108 Backup Successful May 21 11:11:16 2011 uxustnqa109 Backup Failed!
May 21 12:11:17 2011 uxustnqa110 Backup Failed!
May 30 08:05:49 2014 uxustnqa111 Backup Successful May 21 14:11:17 2011 uxustnqa112 Backup Failed!
May 21 15:11:17 2011 uxustnqa113 Backup Failed!
May 19 11:14:25 2011 uxustnqa114 Backup Successful May 21 10:11:16 2011 uxustnqa115 Backup Failed!
Aug 7 02:11:16 2011 uxustnqa116 Backup Failed!
Aug 7 03:11:16 2011 uxustnqa117 Backup Failed!
May 22 04:11:15 2011 uxustnqa118 Backup Failed!
Aug 7 05:11:16 2011 uxustnqa119 Backup Failed!
Aug 7 06:11:16 2011 uxustnqa120 Backup Failed!
May 22 11:11:16 2011 uxustnqa121 Backup Failed!
May 22 12:11:16 2011 uxustnqa122 Backup Failed!
May 22 13:11:16 2011 uxustnqa123 Backup Failed!
May 20 10:15:09 2011 uxustnqa124 Backup Successful May 20 11:39:17 2011 uxustnqa125 Backup Successful May 20 12:15:05 2011 uxustnqa126 Backup Successful Aug 7 07:11:16 2011 uxustnqa127 Backup Failed!
Aug 7 08:11:15 2011 uxustnqa128 Backup Failed!
Aug 4 01:11:15 2011 uxustnqa129 Backup Failed!
Feb 25 11:40:00 2011 uxustnqa130 Backup Successful Apr 7 12:11:16 2011 uxustnqa131 Backup Failed!
Apr 7 13:11:16 2011 uxustnqa133 Backup Failed!
May 19 02:13:53 2011 uxustnqa301 Backup Successful Aug 7 09:11:17 2011 uxustnqa302 Backup Failed!
Aug 7 10:11:16 2011 uxustnqa303 Backup Failed!
Aug 4 03:11:17 2011 uxustnqa304 Backup Failed!
Aug 4 04:11:17 2011 uxustnqa305 Backup Failed!
Aug 5 01:11:16 2011 uxustnqa306 Backup Failed!
Aug 4 05:11:17 2011 uxustnqa307 Backup Failed!
Aug 5 02:11:16 2011 uxustnqa308 Backup Failed!
May 30 08:08:47 2014 uxustnqa309 Backup Successful May 30 08:08:08 2014 uxustnqa311 Backup Successful Aug 4 07:11:17 2011 uxustnqa312 Backup Failed!
Aug 5 04:11:16 2011 uxustnqa313 Backup Failed!
Aug 5 05:11:16 2011 uxustnqa314 Backup Failed!
Aug 5 06:11:17 2011 uxustnqa315 Backup Failed!
Aug 5 07:11:16 2011 uxustnqa316 Backup Failed!
Aug 4 08:11:16 2011 uxustnqa317 Backup Failed!
Aug 5 08:11:16 2011 uxustnqa318 Backup Failed!
Aug 4 09:11:16 2011 uxustnqa319 Backup Failed!
Mar 31 14:17:28 2011 uxustnqa320 Backup Successful Aug 6 16:11:16 2011 uxustnqa401 Backup Failed!
May 23 20:15:38 2014 uxustnqa402 Backup Successful Aug 6 17:11:16 2011 uxustnqa403 Backup Failed!
May 22 16:11:16 2011 uxustnqa404 Backup Failed!
Aug 4 15:11:16 2011 uxustnqa405 Backup Failed!
May 20 15:11:16 2011 uxustnqa406 Backup Failed!
May 23 20:11:15 2014 uxustnqa901 Backup Successful May 23 20:11:39 2014 uxustnqa902 Backup Successful May 27 20:16:48 2014 uxustnst001 Backup Successful May 27 20:11:38 2014 uxustnst002 Backup Successful May 27 20:14:03 2014 uxustnst003 Backup Failed!
May 27 20:13:36 2014 uxustnst004 Backup Failed!
May 27 21:04:51 2014 uxustnst101 Backup Successful May 27 21:04:19 2014 uxustnst102 Backup Successful May 27 21:10:39 2014 uxustnst103 Backup Successful May 27 21:10:31 2014 uxustnst104 Backup Successful May 27 21:06:17 2014 uxustnst105 Backup Successful May 27 22:11:51 2014 uxustnst106 Backup Successful May 27 22:11:53 2014 uxustnst107 Backup Successful May 27 22:09:14 2014 uxustnst108 Backup Successful May 27 22:12:24 2014 uxustnst109 Backup Successful May 27 22:12:13 2014 uxustnst110 Backup Successful May 27 23:10:41 2014 uxustnst111 Backup Successful May 27 23:11:51 2014 uxustnst112 Backup Successful May 27 23:05:18 2014 uxustnst113 Backup Successful May 27 23:05:16 2014 uxustnst114 Backup Successful May 27 23:12:07 2014 uxustnst115 Backup Successful May 27 00:08:22 2014 uxustnst116 Backup Failed!
May 7 02:41:15 2013 uxustnst117 Backup Failed!
May 2 02:41:16 2013 uxustnst118 Backup Failed!
Apr 5 03:10:01 2011 uxustnst120 Backup Failed!
May 27 00:10:05 2014 uxustnst122 Backup Successful Jan 21 00:00:00 2014 uxustnst124 Backup Failed!
Jan 21 00:00:00 2014 uxustnst125 Backup Failed!
May 27 00:12:30 2014 uxustnst127 Backup Failed!
May 27 01:14:22 2014 uxustnst128 Backup Successful May 27 01:14:06 2014 uxustnst129 Backup Successful May 27 01:13:39 2014 uxustnst130 Backup Successful May 27 01:13:26 2014 uxustnst131 Backup Successful May 27 01:12:55 2014 uxustnst132 Backup Successful May 27 02:03:09 2014 uxustnst133 Backup Successful May 27 02:10:57 2014 uxustnst134 Backup Successful May 27 02:11:31 2014 uxustnst135 Backup Successful May 27 02:09:16 2014 uxustnst136 Backup Successful May 27 02:10:14 2014 uxustnst137 Backup Successful May 27 03:11:41 2014 uxustnst138 Backup Successful May 27 03:11:02 2014 uxustnst139 Backup Successful May 27 03:12:06 2014 uxustnst140 Backup Successful May 27 03:12:51 2014 uxustnst141 Backup Successful May 27 03:10:53 2014 uxustnst142 Backup Successful May 27 04:09:25 2014 uxustnst143 Backup Successful May 27 04:03:52 2014 uxustnst144 Backup Successful May 27 04:04:01 2014 uxustnst145 Backup Successful May 27 04:09:34 2014 uxustnst146 Backup Successful May 27 04:09:10 2014 uxustnst147 Backup Failed!
Jun 5 17:11:15 2013 uxustnst148 Backup Failed!
Jun 5 17:41:15 2013 uxustnst149 Backup Failed!
Apr 6 18:11:15 2011 uxustnst151 Backup Failed!
May 27 05:10:57 2014 uxustnst153 Backup Successful Jan 21 05:00:01 2014 uxustnst155 Backup Failed!
Jan 21 05:00:01 2014 uxustnst156 Backup Failed!
May 27 05:13:19 2014 uxustnst158 Backup Successful May 27 05:04:37 2014 uxustnst159 Backup Successful May 27 06:06:23 2014 uxustnst160 Backup Successful May 27 06:06:12 2014 uxustnst161 Backup Successful May 27 06:05:57 2014 uxustnst162 Backup Successful May 27 06:12:19 2014 uxustnst163 Backup Successful May 27 06:12:12 2014 uxustnst164 Backup Successful May 27 07:11:46 2014 uxustnst165 Backup Successful May 27 07:12:31 2014 uxustnst166 Backup Successful May 27 07:13:15 2014 uxustnst167 Backup Successful May 27 07:11:57 2014 uxustnst168 Backup Successful May 27 07:08:17 2014 uxustnst169 Backup Successful May 28 20:11:55 2014 uxustnst170 Backup Successful May 28 20:12:45 2014 uxustnst171 Backup Failed!
May 28 20:10:36 2014 uxustnst172 Backup Successful May 28 20:12:52 2014 uxustnst173 Backup Failed!
May 28 20:13:04 2014 uxustnst174 Backup Successful May 28 21:12:36 2014 uxustnst175 Backup Successful May 28 21:11:28 2014 uxustnst176 Backup Failed!
May 28 21:14:41 2014 uxustnst177 Backup Successful May 28 21:14:03 2014 uxustnst178 Backup Successful May 28 21:14:05 2014 uxustnst179 Backup Successful May 28 22:13:04 2014 uxustnst180 Backup Successful May 28 22:06:53 2014 uxustnst181 Backup Successful May 28 22:07:52 2014 uxustnst182 Backup Successful May 28 22:04:59 2014 uxustnst183 Backup Successful May 28 22:04:46 2014 uxustnst184 Backup Successful May 28 23:14:52 2014 uxustnst301 Backup Successful May 28 23:16:19 2014 uxustnst302 Backup Failed!
May 28 23:12:52 2014 uxustnst303 Backup Successful May 7 05:10:00 2013 uxustnst304 Backup Failed!
May 28 23:13:57 2014 uxustnst305 Backup Failed!
May 31 10:39:00 2013 uxustnst306 Backup Failed!
May 7 06:10:00 2013 uxustnst307 Backup Failed!
May 31 10:40:00 2013 uxustnst308 Backup Failed!
May 28 23:14:25 2014 uxustnst309 Backup Successful Jul 16 09:20:56 2013 uxustnst310 Backup Successful May 28 00:17:04 2014 uxustnst311 Backup Successful May 28 00:17:41 2014 uxustnst312 Backup Successful May 28 00:17:57 2014 uxustnst313 Backup Failed!
May 28 00:17:23 2014 uxustnst314 Backup Successful May 28 00:13:32 2014 uxustnst315 Backup Successful Apr 5 08:41:16 2011 uxustnst316 Backup Failed!
May 28 01:21:49 2014 uxustnst317 Backup Successful May 28 01:04:18 2014 uxustnst318 Backup Successful May 28 01:20:05 2014 uxustnst319 Backup Successful May 28 01:20:48 2014 uxustnst320 Backup Successful May 28 01:21:00 2014 uxustnst321 Backup Failed!
Feb 13 05:40:00 2013 uxustnst322 Backup Failed!
May 28 02:12:09 2014 uxustnst323 Backup Successful Feb 13 06:40:00 2013 uxustnst324 Backup Failed!
Feb 13 07:10:00 2013 uxustnst325 Backup Failed!
Feb 13 07:40:00 2013 uxustnst326 Backup Failed!
May 28 02:13:45 2014 uxustnst327 Backup Successful Jul 17 10:18:19 2013 uxustnst328 Backup Successful May 28 02:15:40 2014 uxustnst329 Backup Successful May 28 02:16:38 2014 uxustnst330 Backup Failed!
May 28 02:16:29 2014 uxustnst331 Backup Successful May 28 03:14:10 2014 uxustnst332 Backup Failed!
May 28 03:15:38 2014 uxustnst333 Backup Failed!
Feb 25 12:27:55 2011 uxustnst334 Backup Successful May 28 03:14:16 2014 uxustnst335 Backup Failed!
May 28 03:05:45 2014 uxustnst336 Backup Failed!
May 3 03:50:01 2013 uxustnst339 Backup Failed!
May 3 04:50:00 2013 uxustnst340 Backup Failed!
May 28 03:11:46 2014 uxustnst401 Backup Successful May 28 04:12:43 2014 uxustnst402 Backup Successful May 28 04:09:33 2014 uxustnst403 Backup Successful May 28 04:12:40 2014 uxustnst404 Backup Successful May 28 04:12:46 2014 uxustnst405 Backup Successful May 28 04:12:41 2014 uxustnst406 Backup Successful May 28 05:14:21 2014 uxustnst901 Backup Successful May 28 05:15:27 2014 uxustnst902 Backup Successful May 28 05:14:17 2014 uxustnst903 Backup Successful May 28 05:13:02 2014 uxustnst904 Backup Successful Jan 22 05:00:01 2014 uxustnst905 Backup Failed!
Jul 18 01:48:26 2013 uxustnst907 Backup Failed!
Jul 12 01:44:44 2013 uxustnst908 Backup Successful May 27 20:10:01 2014 uxustnst909 Backup Successful May 28 05:16:24 2014 uxustnst910 Backup Successful Feb 25 12:07:58 2011 uxustntc001 Backup Successful Feb 25 12:09:08 2011 uxustntc002 Backup Successful Jul 12 15:03:40 2013 uxustntr001 Backup Successful Jul 12 15:03:41 2013 uxustntr002 Backup Failed!
May 23 20:09:43 2014 uxustnx2001 Backup Successful May 23 20:09:55 2014 uxustnx2002 Backup Successful May 23 21:08:32 2014 uxustnx2401 Backup Successful May 23 21:08:41 2014 uxustnx2402 Backup Successful May 23 21:09:30 2014 uxustnx2403 Backup Successful May 23 21:13:47 2014 uxustnx2901 Backup Successful Aug 17 15:10:00 2012 uxustnxx002 Backup Failed!
Aug 18 08:40:01 2012 uxustnxx801 Backup Failed!
May 30 00:07:05 2014 uxuswayz002 Backup Successful Mar 13 09:45:52 2010 uxuswayz006 Backup Successful May 30 02:09:54 2014 uxuswayz008 Backup Successful May 30 00:15:46 2014 uxuswayz010 Backup Successful May 30 02:08:17 2014 uxuswayz011 Backup Successful May 30 00:08:17 2014 uxuswayz015 Backup Successful May 30 02:09:39 2014 uxuswayz040 Backup Successful May 30 01:06:43 2014 uxuswayz041 Backup Successful May 30 01:08:43 2014 uxuswayz042 Backup Successful May 30 01:06:51 2014 uxuswayz043 Backup Successful May 30 02:20:41 2014 uxuswayz045 Backup Successful May 30 08:03:14 2014 uxuswich007 Backup Failed!
Dec 16 16:42:04 2013 uxuswich009 Backup Successful May 30 07:00:05 2014 wkrs1 Backup Failed!
May 30 07:08:40 2014 wkrs10 Backup Successful May 30 07:06:09 2014 wkrs11 Backup Successful May 30 08:12:52 2014 wkrs3 Backup Successful May 30 08:09:23 2014 wkrs4 Backup Successful May 30 07:10:44 2014 wkrs5 Backup Successful Jul 20 02:55:44 2013 wkrs6 Backup Failed!
May 30 07:05:36 2014 wkrs7 Backup Successful May 30 07:05:44 2014 wkrs8 Backup Successful May 30 08:05:07 2014 wkrs9 Backup Failed!
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40101716
Seems there are a few *.log files in the directory which are not really mksysb logs.

Try this:

#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT="/tmp/mksysb_summary"
MAILTO="recipient1@domain1.tld recipient2@domain2.tld recipient3@domain3.tld"

for LOG in $DIR/nim_mksysb*.log
  do
    DATE=$(istat $LOG | awk -F'ied:\t' '/Last modified:/ {print substr($2,5)}')
    MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
    grep -q "0512-038 mksysb: Backup Completed Successfully." $LOG && STATE="Backup Successful" || STATE="Backup Failed!"
    echo $DATE $MACHINE $STATE
    unset DATE MACHINE STATE
  done > $OUT
mailx -s "MKSYSB Summary from NIM Server $(hostname)" $MAILTO < $OUT
rm $OUT
                                         
If this still fails change the "echo" line from

echo $DATE $MACHINE $STATE

to

printf "%s\n"  "$DATE $MACHINE $STATE"
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40101892
Woolmilkporkji
                  Still I am getting same above Erranous output format is coming. shell we try to get failed backup set in one file and success in another file.
I am running below script
#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT="/tmp/mksysb_summary"
MAILTO="my mail id"

for LOG in $DIR/nim_mksysb*.log
  do
      DATE=$(istat $LOG | awk -F'ied:\t' '/Last modified:/ {print substr($2,5)}')
          MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
              grep -q "Backup Completed Successfully" $LOG && STATE="Backup Successful" || STATE="Backup Failed!"
                 printf "%s\n"  "$DATE $MACHINE $STATE"
                      unset DATE MACHINE STATE
                        done > $OUT
                        mailx -s "MKSYSB Summary from NIM Server $(hostname)" $MAILTO < $OUT
                        rm $OUT
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40101903
Do you see the erroneous output in the email or do you look at the original output file?

If it's the email, please comment out the last line of the script:

 "rm $OUT"

should become

"#rm $OUT"

Then run the script and inspect the file "/tmp/mksysb_summary" using "vi" or "more".

Do you see the wrong ouput there?

Weird thing is that the script works just fine for me! I've built a test environment and can get the desired output (file or email) without any linefeed issues.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40102087
Another try:

#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT="/tmp/mksysb_summary"
MAILTO="my mail id"

for LOG in $DIR/nim_mksysb*.log
  do
      DATE=$(istat $LOG | awk -F'ied:\t' '/Last modified:/ {print substr($2,5)}')
          MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
              if grep -q "Backup Completed Successfully" $LOG
                     then
                        STATE="Backup Successful"
                          else
                            STATE="Backup Failed!"
              fi

                 printf "%s\n"  "$DATE $MACHINE $STATE"
                      unset DATE MACHINE STATE
                        done > $OUT
                        mailx -s "MKSYSB Summary from NIM Server $(hostname)" $MAILTO < $OUT
                        rm $OUT
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40105948
Hi Woolmilkporkji,
       Still output is not comping in expected way. It is coming in the same way updated earlier

Could you help to get script to collect failed backup in seperate file and successfull backup in seperate file?
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 40106125
Here we go one more time:

#!/bin/ksh

DIR="/opt/cargill/adm/logs/nim_mksysb"
OUT_SUCCESS="/tmp/mksysb_success_summary"
OUT_FAILURE="/tmp/mksysb_failure_summary"
    cat /dev/null > $OUT_SUCCESS
    cat /dev/null > $OUT_FAILURE
MAILTO="my mail id"

for LOG in $DIR/nim_mksysb*.log
  do
      DATE=$(istat $LOG | awk -F'ied:\t' '/Last modified:/ {print substr($2,5)}')
          MACHINE=$(awk '/Machine to backup is/ {print $5}' $LOG)
              if grep -q "Backup Completed Successfully" $LOG
                     then
                        printf "%s\n"  "$DATE $MACHINE Backup Successful!" >> $OUT_SUCCESS
                          else
                             printf "%s\n"  "$DATE $MACHINE Backup Failed!" >> $OUT_FAILURE
               fi
  done
                        mailx -s "MKSYSB Success Summary from NIM Server $(hostname)" $MAILTO < $OUT_SUCCESS
                        mailx -s "MKSYSB Failure Summary from NIM Server $(hostname)" $MAILTO < $OUT_FAILURE
                       # rm $OUT_SUCCESS $OUT_FAILURE


... although I don't think this will change anything.

Again: Do you see the wrong output in the email or in the summary file?
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40106264
let me check once backup schedule completed woolmilkporcji
0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 40129802
I've requested that this question be closed as follows:

Accepted answer: 0 points for rammaghenthar's comment #a40106264

for the following reason:

It was working as I expected
0
 
LVL 2

Author Closing Comment

by:rammaghenthar
ID: 40129803
This script was as expected
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now