Hi I have the following script and have problem debugging the problems. The function of this script is to make sure the entire file is being received (the filesize of a data is not changing after 20 seconds) and start moving the file to another directory. This script should be started every 30mins.
I have the following errors:
Code:
#!/usr/bin/ksh
. /opt/Modules/init/ksh
SF_BASAR=/opt/bs/sf
UMC_MASK=/home/umc/dropbox/test
FLAGLIST=/home/umc/dropbox/test/flaglist
FILELIST=/home/umc/dropbox/test/filelist
DIRECTORY=/home/umc/dropbox/datacentre
#store the name of files in bs/sf to filelist
ls -l $SF_BASAR | nawk '{print $9}' > $FILELIST
#compare flag in flaglist with items in $SF_BASAR
#delete flag in flaglist that are not in $SF_BASAR
egrep "$(<$FILELIST)" $FLAGLIST > flaglist.tmp
mv -f flaglist.tmp $FLAGLIST
#if there is an flag in flaglist,exit
NO_OF_FILES=ls /opt/bs/sf/*.gds* | wc -w | nawk '{print $1}'
if (`ls -l $FLAGLIST | nawk `{print $5}'' != "0") then
exit 1
else
if ($NO_OF FILES != "0") then
for i in `ls $SF_BASAR/*.gds*` do
filesize1=`ls -l $i | nawk `{print $5}''
sleep 20
filesize2=`ls -l $i | nawk `{print $5}''
if $filesize1=$filesize2 then
#move the file
mv i $UMC_MASK
#create flag in flaglist
echo $i >> FLAGLIST
fi
done
fi
fi
I have the following errors:
Code:
script: /opt/bs/sf/file1.gds.gdz.gpg: cannot execute
0
script[23]: syntax error at line 29 : `filesize1=`ls -l $i | nawk `{print' unexpected