我经常从 ftp 服务器下载一个日志文件(顺便说一句,我无法控制它),每次下载整个文件似乎都相当冗长。
所以我正在寻找一个程序(linux-ish)或 Perl 模块,它以某种方式结合了 ftp 和 rsync,并且只“更新”文件。
日志文件不断增长。
周围有这样的吗?
安装 curlftpfs(如果在 Windows 上,使用 cygwin) # 创建本地挂载路径 mkdir -p /mnt/myftp # 使用 curlftpfs 挂载目标 ftp 站点 curlftpfs -o allow_other ftp://myusername:mypassword@ftp.mydomain.com /mnt/myftp # rsync 使用附加选项就地同步 # 使用长超时值作为第一个长阶段 #(就地比较)需要一段时间 rsync -rzvvv --inplace --append --progress --stats --timeout=7200 /mnt/myftp/path/to/source/file.log /path/to/local/destination/file.log # 当你需要卸载 ftp 站点时 sudo 卸载 myftp # 您也可以通过附加以下行从 /etc/fstab 挂载 # curlftpfs#myusername:mypassword@ftp.mydomain.com /mnt/myftp fuse allow_other,rw,user,noauto 0 0 # 参考: # 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
“恢复下载”不适用于您的情况吗?
假装您的传输上次中止并从您停止的地方重新开始下载
如How to use rsync over FTP中所述,lftp有一个镜像模式,这使得同步比 curlftpfs+rsync 更有效率