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
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