FTP Script error - AIX

Hi,

I'm trying to create a ftp script so I can make an ftp connection and start upload and download files from/to remote servers.

In this case I want to start a connection (crontab) and transfer files from localserver1 to remoteserver; remoteserver to localserver1; finally from localserver1 to localserver2.

I changed the .netrc file and create the following entry:

# machine       sample login userid password userpswd
machine (connection to IP address) login (username) password (password)
macdef init
passive
ascii
prompt
cd /pub/in
lcd /home/remoteserver/in
mget *
mdelete *
cd /pub/out
lcd /home/localserver1/out
mput *
bye
cd /home/localserver1/in
rcp * localserver2:/imp
rm *
cd /home/localserver1/out
rm *

Note: My OS is AIX 4.3i, if I start the connection manually it works fine but if I execute the complete script it stops after the connection with the remoteserver is closed and no files are transfer from localserver1 to localserver2.

Can someone help?

Maybe this can help?:

http://www.unix.com/shell-programming-scripting/12034-ftp-script.html

1 Like

The .netrc file does not contain script commands. It is a method for providing the username and password for a given machine. There is one line for this purpose for each machine-username combination. See "man .netrc".

Ps. The link in the previous post is good.

Tanks for this tip, I create a script that calls the .netrc procedure with the files transfer fron localserver1 and remoteserver. The ftp transfer from localserver1 to localserver2 comes at the end of the script, now I just have to find a way to get the connection log.