chippymike
Technical User
Hi All,
I'm looking for a solution to the following problem.....
1) Files are transferred to a directory (/dir_path/import) from another server using FTP.
2)Once the FTP process is complete the script renames the file from "*.chm.tmp" to ".chm" - In other word the ".tmp" extension is dropped.
3)Our present script then moves the file from /dir_path/import to /dir_path/process and changes the ".chm" extension to a ".imp" extension.
4) At present the script acts on the files which still have a ".tmp" extension - i.e. before the FTP process is complete.
I need the script to act on files with a ".chm" extension only.I thought that something like this would go some way to solving the problem but it won't even compile.
if [ -f ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp ]
then
logit ${PROD_FILE_PREFIX}.tmp exists on $PROCESSDIR
else
logit No files with the .tmp extension were found
continue
# If a .tmp file is found, check that it is complete (i.e. not growing)
GROWING=1
while [ GROWING -eq 1 ]
do
_size=`ls -l ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp | cut -c32-41`
sleep 60 # wait a minute
_size_now=`ls -l ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp | cut -c32
-41`
if [ $_size = $_size_now ]
then
GROWING=0
fi
done
# Now check if the file contains records ; 0 byte files can be deleted
if [ -s ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp ]
then
# mail support
logit ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp file found
messageOperator $DATE 00019 ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp
fi
I know it's asking a lot but any help would be greatly appreciated!
Cheers!
I'm looking for a solution to the following problem.....
1) Files are transferred to a directory (/dir_path/import) from another server using FTP.
2)Once the FTP process is complete the script renames the file from "*.chm.tmp" to ".chm" - In other word the ".tmp" extension is dropped.
3)Our present script then moves the file from /dir_path/import to /dir_path/process and changes the ".chm" extension to a ".imp" extension.
4) At present the script acts on the files which still have a ".tmp" extension - i.e. before the FTP process is complete.
I need the script to act on files with a ".chm" extension only.I thought that something like this would go some way to solving the problem but it won't even compile.
if [ -f ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp ]
then
logit ${PROD_FILE_PREFIX}.tmp exists on $PROCESSDIR
else
logit No files with the .tmp extension were found
continue
# If a .tmp file is found, check that it is complete (i.e. not growing)
GROWING=1
while [ GROWING -eq 1 ]
do
_size=`ls -l ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp | cut -c32-41`
sleep 60 # wait a minute
_size_now=`ls -l ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp | cut -c32
-41`
if [ $_size = $_size_now ]
then
GROWING=0
fi
done
# Now check if the file contains records ; 0 byte files can be deleted
if [ -s ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp ]
then
# mail support
logit ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp file found
messageOperator $DATE 00019 ${PROCESSDIR}/${PROD_FILE_PREFIX}.tmp
fi
I know it's asking a lot but any help would be greatly appreciated!
Cheers!