|
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]
|