Veritas-bu

[Veritas-bu] ksh93 WAS: RE: Script to collect hourly data...

2006-07-28 14:37:32
Subject: [Veritas-bu] ksh93 WAS: RE: Script to collect hourly data...
From: M.W.Ellwood at rl.ac.uk (Ellwood, MW (Mike))
Date: Fri, 28 Jul 2006 19:37:32 +0100
Joe,
 
Sorry this reply is not about your script per se, and arguably
off-topic, but may be of interest to many script hackers here:
 
_If_ you are going to use ksh for this kind of thing, then there is no
reason why you should be shackled to the ksh 88 variant which is still
being shipped with a lot of platforms.
 
David Korn et al produced a new version, ksh93, which is being regularly
updated and maintained by him and colleagues at AT&T Research.
It is also now open source (although you have to "sign" an agreement to
download it, but it's no big deal).
 
Note that this is not pdksh, which is shipped with some versions of
Linux.
In fact Redhat is now shipping ksh93 I believe.
 
However, anyone can download ksh93  (and other things) for a variey of
platforms, from:
 
http://www.research.att.com
  "software tools"->"ast"
or
http://www.research.att.com/sw/download/
 
See also
http://www.kornshell.com/
 
 
I should say that I use ksh93 (on Solaris and Linux)  every day, and I
think it's great (and I'd like to see others get the benefit of it).
The only thing I would say is that it lacks something in the
documentation department.
 
There is an updated(-ish) version of the classic reference book by
Bolsky & Korn, which does cover ksh93 (though probably not recent point
releases).
A more approachable book is "Learning the Korn Shell" by Rosenblatt &
Robbins, which is very good, although not quite as comprehensive as I
would like, and it is also slightly out of date.
 
There is also quite an active mailing list pointed to from the AT&T site
 
 
One of the big advantages of ksh93 over ksh 88 is that it supports
floating point arithmetic.
Another is that it has extensive support for regular expressions,
approaching the power of perl in that respect, although the syntax is
slightly different. I believe that the very latest version has a "match"
operator,, =~ similar to perl, which may permit the same sort of
regexes, but I have not tried this yet. ( believe there is actually a
bug in the one currently available, but the fixed version should be out
soon. Check the change log when you download.
 
Happy scripting,
 
Regards,
 
Mike Ellwood
 
p.w. In "ast", there is also a unix emulator for windows, uwin, similar
to cygwin, which works pretty well I've found, giving you a ksh command
line to a windows machine, vi, etc.
 

        -----Original Message-----
        From: veritas-bu-bounces at mailman.eng.auburn.edu
[mailto:veritas-bu-bounces at mailman.eng.auburn.edu] On Behalf Of Joseph
Despres
        Sent: 28 July 2006 18:23
        To: veritas-bu at mailman.eng.auburn.edu
        Subject: [Veritas-bu] Script to collect hourly data...
        
        

        Well I wrote a script to check the amount of backups that look
back 
        one hr and list the amount on a per media server basis: 
        
        Please check it out: 
        
        #****************** Cut Here ******************# 
        
        #!/bin/ksh 
        
        #  Script to collect Data 
        
        ## Variables 
        
        HRS=$1 
        ADMINCMD="/usr/openv/netbackup/bin/admincmd" 
        MYHOME="/home/jdespres/bin" 
        BPCONF="/usr/openv/netbackup/bp.conf" 
        MedisS="/home/jdespres/HourlyData/MediaS.txt" 
        TMP1="/home/jdespres/HourlyData/orignalbpconf.txt" 
        DATELOG=`date +%m%d%Y%H%M%S` 
        LOGFILE="/home/jdespres/HourlyData/VolumeAmount.rpt" 
        Who_Cares="jdespres at csc.com" 
        
        
        #### Get a list of all the media servers and sort it as well! 
        
        grep "^SERVER " $BPCONF|sed '1,1'd|awk '{print $3}' > $TMP1 
        cat $TMP1 | sort > $MedisS 
        
        #### Function to collect data 
        
        collect_data() { 
        
        date 
        
        for i in `cat $MedisS` 
        do 
        echo "$i \c" 
        $ADMINCMD/bpimagelist -l -hoursago $HRS|egrep "^FRAG"|grep -v
"\-1"| grep $i|awk '{ tot+=$4 } END {printf "%9.5f\n", (tot/1024)/1024}'

        done 
        } 
        
        collect_data > $LOGFILE.$DATELOG 
        
        /usr/bin/mailx -s "`hostname` Hourly Volume info `date
'+%m/%d/%y %H:%M'`" $Who_Cares < $LOGFILE.$DATELOG 
        
        #****************** Cut Here ******************# 
        
        
        Does this make sense.....  it seems to give up the correct info:

        
        
        Joe Despres...........
        
        
        
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------
        This is a PRIVATE message. If you are not the intended
recipient, please delete without copying and kindly advise us by e-mail
of the mistake in delivery. NOTE: Regardless of content, this e-mail
shall not operate to bind CSC to any order or other contract unless
pursuant to explicit written agreement or government initiative
expressly permitting the use of e-mail for such purpose.
        
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------
        

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://mailman.eng.auburn.edu/pipermail/veritas-bu/attachments/20060728/4d08b95b/attachment-0001.html

<Prev in Thread] Current Thread [Next in Thread>