I have a question in the forum about output files and no answer yet. But after a full blown test of this script I realized that I have two issues, the first issue is: My second if statement is not appending to the file that I have in my first if statement. Why is this happening? My second issue is if I had more than one file missing, I only have one file listed in my output list, knowing well that I have more than one. Here is the script.
It is written in korn for an MPE HP3000 system. It works the same, but don't let the capital letters of the dir confuse you.
#!/bin/ksh -x
set -x
callci "showjob"
SERVER=`uname -n`
DATE=`date`
TOCDISC=/DJ/PUB/TOCDISC3
OUTFILE=/DJ/PUB/OUTFILE
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}" > OUTFILE
print "CREATION DATE IS:----------------${DATE}" >> OUTFILE
print "FILE MISSING:--------------------${V1}" >> OUTFILE
ls /SYS/PUB/LOG*
fi
if [ ${V2} -ne ${V3} ]
then
print "BYTE MISMATCH:${V1} THIS FILE HAS ${V3} BYTES" >> OUTFILE
print "YOU SHOULD HAVE: ${V2} BYTES" >> OUTFILE
print "CHECK S/W VERSION!" >> OUTFILE
fi
done
It is written in korn for an MPE HP3000 system. It works the same, but don't let the capital letters of the dir confuse you.
#!/bin/ksh -x
set -x
callci "showjob"
SERVER=`uname -n`
DATE=`date`
TOCDISC=/DJ/PUB/TOCDISC3
OUTFILE=/DJ/PUB/OUTFILE
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}" > OUTFILE
print "CREATION DATE IS:----------------${DATE}" >> OUTFILE
print "FILE MISSING:--------------------${V1}" >> OUTFILE
ls /SYS/PUB/LOG*
fi
if [ ${V2} -ne ${V3} ]
then
print "BYTE MISMATCH:${V1} THIS FILE HAS ${V3} BYTES" >> OUTFILE
print "YOU SHOULD HAVE: ${V2} BYTES" >> OUTFILE
print "CHECK S/W VERSION!" >> OUTFILE
fi
done