The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: FTP automated?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-11-2001
kornshellmaven kornshellmaven is offline
Registered User
  
 

Join Date: Apr 2001
Posts: 25
We use variations on the following script all over the place. We designed an "FTP server" written in korn shell to handle ALL FTP's between different platforms aw well as our corporate "Enterprise FTP server (Sterling Mailbox)

All variables are defined before invoking the FTP. (Currently in a flat file - soon to be in a DB table)


Contents of DYNAM_FTP.KSH:
#!/etc/usr/ksh
assorted variable assignments
ftp -n -v $HOSTNAME <<-END
user $USERID $PASSWORD
cd $SRC_DIR
lcd $TARGET_DIR
pwd
get $SRC_FILE
END


The above "here document" is dynamically built based on a control record which specifies source info (IP, id, password, filename, etc.)
External to the above:
chmod +x DYNAM_FTP.KSH
DYNAM_FTP.KSH to invoke
We capture the output of the above to a file and then grep for various errors....

[Edited by kornshellmaven on 05-12-2001 at 06:58 PM]