Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

korn script and sendmail

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
Newbie.

I have this korn script that produces an outfile, I would like to have this output file email me when the file is present. How can I do this?

Here is the script:
#!/bin/ksh -x

set -x

callci "showjob"

SERVER=`uname -n`
DATE=`date`
TOCDISC=/DJ/PUB/TOCDISC
OMNIOUT=/DJ/PUB/OMNIOUT
> $OMNIOUT #create/overwrite before the for loop

for iii in `cat ${TOCDISC}`
do
V1=`echo ${iii}|/bin/cut -d ":" -f1`
V2=`echo ${iii}|/bin/cut -d ":" -f2`
V3=`/bin/ls -l ${V1}|awk '{print $5}'`

if [ ! -f ${V1} ]
then
print "THIS FILE WAS CREATED ON:--------${SERVER}" >> $OMNIOUT

print "CREATION DATE IS:----------------${DATE}" >> $OMNIOUT

print "FILE MISSING:--------------------${V1}" >> $OMNIOUT

ls /SYS/PUB/LOG*
fi

if [ ${V2} -ne ${V3} ]
then
print "BYTE MISMATCH:${V1} THIS FILE HAS ${V3} BYTES" >>$OMNIOUT

print "YOU SHOULD HAVE: ${V2} BYTES" >> $OMNIOUT
print "CHECK S/W VERSION!" >> $OMNIOUT
fi
done

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top