Connection, login and upload files to ftp server via shell script
In my network there are:
Machine A (ftp server running ProFTPd) Machine B In Machine B, at /root, there is .netrc file that controls successfully auto-login to Machine A. From the command line the connection and login are fine, but how can I do to, via shell script, execute the connection, login and upload some files as I do interactively in command line? Thanks in advance Paulo Góes |
Re: Connection, login and upload files to ftp server via shell script
Quote:
ftp server<<EOF ftp command 1 ftp command 2 ....... bye EOF There shouldn't be iany leading space before the last EOF. You can use any string in place of EOF. 2) Second way is (ftp command1 ; sleep 1; ftp command 2 ; sleep 1; ftp command 3; sleep 1 )| ftp server This should work fine . Note the "sleeps" .. they are added to give the server some time to respond. The only problem is it sends it as a bunch to the server and if the server is slow then it may not work correctly(1%). 3) Third way is to use TCL expect. Expect allows you to automate anything. It's brilliant. |
Try to do your job using perl is pretty simple with Net::FTP module!
|
All times are GMT -5. The time now is 08:27 PM. |