使用Curlftpfs+Unison实现本地目录与FTP间双向同步

Standard

我们这边美工的基本工作流程是先从设在北美办公室的FTP机器上下载相关需求文档及图形元素,做完后再上传过去.
因为图片之类的都比较大,加上两地间网速原因,实际使用过程中浪费了不少时间在上下传的过程中.
比较简单的解决方法是在我们下班后将北美办公室的FTP和这边当天所完成的工作进行双向更新同步.

具体,先使用`curlftpfs`将北美的FTP mount到本地Server,然后在本地另建一个本地目录用于和FTP mount做双向同步,用crontab定时运行`unison`,并且将本地目录Samba.

[yemaoshen@local ~] # rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[yemaoshen@local ~] # yum install curlftpfs
[yemaoshen@local ~] # make ftp_test
[yemaoshen@local ~] # curlftpfs ftp://IP_ADDRESS/test/ /home/yemaoshen/ftp_test/ -o user="yemaosheng:com" -o allow_other
[yemaoshen@local ~] # #相当于umout# fusermount -u /home/yemaosheng/ftp_test/
[yemaoshen@local ~] # make local_test
[yemaoshen@local ~] # yum install unison
[yemaoshen@local ~] # unison ./ftp_test ./local_test -auto -silent

要是报FATAL: Module fuse not found.记得再yum install dkms dkms-fuse一下

如果只需单向同步的话,这边有人写了个perl脚本满好用的,下载地址: http://ossw.ibcl.at/FTPSync/

[yemaoshen@local ~] # ./ftpsync.pl ftp://yemaosheng:com@IP_ADDRESS/test /home/yemaosheng/local_test

转载请注明出处 http://yemaosheng.com

One thought on “使用Curlftpfs+Unison实现本地目录与FTP间双向同步

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.