Check that file has been transfered completely from UNIX using ftp
Posted on 2004-09-28
I am ftp'ing a file to a remote server using a unix.prog file scheduled through Oracle. I would like to know if the ftp process fails by receiving some type of email alert. I have hacked together a bit of code that I have found, but this does not fully address the issue. The current code returns successful as long as the ftp connection is made, but I need to know that the file has been uploaded complete. Is there a simple way to incoroporate this feature?
I very very little experience with Unix, so please be desciptive if possible.
Thanks in advance.
Here is some of my current code:
# Set some variables to be used in this script
# Change Dir to UTL_FILE directory
ftp <<** 22.214.171.124
if [ "$?" -ne 0 ]
echo "FTP Failed to move $FNAME1"
mailx -s"*** Some_Data Failed to Upload Properly ***" email@example.com
echo "FTP'd $FNAME1"
mailx -s"The Some_Data upload was successful" firstname.lastname@example.org