ftp转rsync方式 [英] Ftp transfer the rsync-way

查看:117
本文介绍了ftp转rsync方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常从ftp服务器下载日志文件(我并不能控制它,顺便说一句),每次下载整个文件似乎有点浪费.

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.

因此,我正在寻找一个程序(linux-ish)或Perl模块,它们以某种方式将ftp和rsync结合在一起,并且仅更新"文件.

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?

推荐答案


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:mypassword@ftp.mydomain.com /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:mypassword@ftp.mydomain.com /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

这篇关于ftp转rsync方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆