[HPADM] script

From: CHANDRASHEKAR, MANI (MANI__CHANDRASHEKAR@fleet.com)
Date: Wed Nov 20 2002 - 10:01:48 EST


        All,

                  This is a question regarding AIX.. I have a mksysb.ksh
script (Basically this is like doing a ignite backup on HP-UX) which makes
the mksysb of the system on to a tape. It also makes an entry in the
mksysb.log.date and mksysb.err.date. when the mksysb is successful, the
mksysb.err.date file is 0 bytes and when it failes there is some entry in
the mksysb.err.date file and is greater than 0 bytes. I want an entry in the
mksysb.ksh script, so that when the mksysb fails and when it makes an entry
in the mksysb.err.date file (i.e. the file is larger than 0 bytes), the
error report has to mail the unix on call person. I know how to use the
mailx command . I want to know how to add the line in the script which would
tell that if the error report is larger than 0 bytes, then it should send
the error report to the on call person..? and where should I have the entry
for the mailx comand. Below is the script.

        #!/bin/ksh
        #This program creates the mksysb image onto tape
        PERC="%"
        host=`hostname`
        Date=`/bin/date "+${PERC}Y${PERC}m${PERC}d"`
        Outputlog="/var/adm/mksysb.log.$Date"
        Errorlog="/var/adm/mksysb.err.$Date"
        echo "`date`: Initiating mksysb on $host ..... " >> $Outputlog
        /usr/bin/mksysb -i -X /dev/rmt0 1>>$Outputlog 2>$Errorlog
        echo "Mksysb completed on $host" >> $Outputlog

        Thanks,

        shekar

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:22 EDT