1832907 Members
3597 Online
110048 Solutions
New Discussion

ftp

 

ftp

I have a process that ftp's multiple large files from my local HP box to another. At times one of the files does not transfer fully and I get "sendfile: Broken pipe" message in root mail. My question is: Is ftp smart enough to recognize this condition and resend that file? Right now, I manually check for this and resend the file. I'm looking for any information or suggestions on how to automate this.

Thanks in advance for all responses.

Nancy
4 REPLIES 4
Ron Kinner
Honored Contributor

Re: ftp

Probably not. My FTP process just gives up if it has problems. After a successful FTP it moves the file to the Archive directory so I have a script which checks periodically to see if the To_Send folder has any files and if it finds one restarts the FTP send process. If it doesn't go this time it will usually go the next time.

Ron
Patrick Wallek
Honored Contributor

Re: ftp

No, unfortunately FTP isn't that smart. What you could have a look at though is the NET::FTP module for Perl. I don't have any experience with this personally, but have heard about what it can do from A. Clay Stephenson. I'm sure he can tell you more about it.
Krishna Prasad
Trusted Contributor

Re: ftp

What I have done in the past is one of two things.

1. Use rcp when ever possible. This may not be possible for you.

2. When I must use ftp I script the ftp put then when the put command completes, I use ftp to create a file that list the files in the directory on the target server. I then break out of ftp and check for the file name that I sent in the ftp command. If the file isn't on the target system I either report an error or retry the ftp put.

Positive Results requires Positive Thinking
A. Clay Stephenson
Acclaimed Contributor

Re: ftp

Hi Nancy:

Since that pesky Patrick gave me some homework to do, here is a Perl script that will do what you want.

It first logs you in to a remote server, change the remote host, user, and password to suit your needs. It then does a cwd to /tmp and puts ftp in 'binary mode'. It then reads the command line for filenames to send. It will try each one up to 5 times. The beauty of doing this in perl is that the error checking is built right in. You will need to download and install the Net::FTP module from http://www.perl.org/CPAN but after that you are done. I never bother trying to do this stuff in the shell anymore because this is so much easier.

P.S. If you need to punch through a proxy server, simply supply a 3rd argument to the login subroutine and it will be just like you typed the account ftp command yourself.

Regards, Clay
If it ain't broke, I can fix that.