Below is a script that I am using to audit a dir against a static file. It works and all. So what i am doing is switching the system log in the begginning so we can close out current log and create a new one. If certain conditions are met via an if statement, then I will copy logfiles from one dir to another. But how do I only do this once? You see, within my static file, I have about 400 files to audit against. A file beginning with the letter "A" is missing, the script will do what the if statements says to do, and then copy according to one of the if statements. Now we get to a file starting with the letter "T" and this is missing, we have to repeat the entire process of copying over the same log files. How do I only do this once?
#!/bin/ksh -x
set -x
callci "switchlog"
TOCDISC=/DJ/PUB/TOCDISC
for i in `cat ${TOCDISC}`
do
V1=`echo ${i}|/bin/cut -d ":" -f1`
V2=`echo ${i}|/bin/cut -d ":" -f2`
V3=`/bin/ls -s ${V1}|awk '{print $1}'`
if [ ! -f ${V1} ]
then
print "File Missing: ${i}${V1}...."
fi
if [ ! -f ${V1} ]
then
cp /SYS/PUB/LOG* /TELESUP/PUB/
fi
if [ ${V2} -ne ${V3} ]
then
print "File: ${i} has a mismatched byte count!! Current count:
${V3}.....Please Correct!!!"
fi
done
#!/bin/ksh -x
set -x
callci "switchlog"
TOCDISC=/DJ/PUB/TOCDISC
for i in `cat ${TOCDISC}`
do
V1=`echo ${i}|/bin/cut -d ":" -f1`
V2=`echo ${i}|/bin/cut -d ":" -f2`
V3=`/bin/ls -s ${V1}|awk '{print $1}'`
if [ ! -f ${V1} ]
then
print "File Missing: ${i}${V1}...."
fi
if [ ! -f ${V1} ]
then
cp /SYS/PUB/LOG* /TELESUP/PUB/
fi
if [ ${V2} -ne ${V3} ]
then
print "File: ${i} has a mismatched byte count!! Current count:
${V3}.....Please Correct!!!"
fi
done