tags:

views:

1155

answers:

4

Hi!

I'm downloading a logfile quite often from a ftp-server (which I'm not in control over, btw), and it seems rather rediciolus to download the whole file every time.

So I'm looking for a program (linux-ish) or Perl module that in a way combines ftp and rsync, and only "updates" the file.

The logfile is constantly growing.

Anything like that around?

A: 

Why not use rsync --append?

Of course you can't connect to an FTP server with rsync, so your server would need to allow you to connect to an sshd or rsyncd.

Bill Karwin
How do I connect to an FTP-server with rsync?
Lasse A Karlsen
@Lasse: you need something like curlftpfs to mount the FTP location to a local directory. Then you can use rsync on it. See Dragos anwswer.
blueyed
A: 

I think you are trying to get rsync features out of ftp and it's not going to work easily. I'd recommend a pure rsync solution.

Glenn
+3  A: 

Wouldn't "resume download" work for your case?

Just pretend your transfer was aborted last time and restart downloading from where you stop

Eric
+2  A: 
Install curlftpfs (if on Windows, use cygwin)

# Create local mount path
mkdir -p /mnt/myftp

# Mount the destination ftp site using curlftpfs
curlftpfs -o allow_other ftp://myusername:[email protected] /mnt/myftp

# rsync inplace using append option
# use a long timeout value as the first long phase
# (the inplace comparison) takes a while
rsync -rzvvv --inplace --append --progress --stats --timeout=7200 /mnt/myftp/path/to/source/file.log /path/to/local/destination/file.log

# When you need to umount the ftp site
sudo umount myftp

# You can also mount from /etc/fstab by appending the following line
# curlftpfs#myusername:[email protected] /mnt/myftp fuse allow_other,rw,user,noauto 0 0

# References:
# http://linux.byexamples.com/archives/344/mounting-ftp-host-to-local-directory-on-top-of-fuse/
# http://lists.samba.org/archive/rsync/2007-May/017762.html
Dragos Toader