我已经设置了rsync来镜像从源服务器(a)到镜像(b)的目录。我已经得到它来发送源上的新文件但是当我从源中删除文件时它不会最终删除它。
以下是我用来调用rsync的内容:
rsync -vhzrplt --stats --delete --rsh='/usr/bin/ssh -q' --exclude="core/" --exclude="cache/" /home/(a)/public_html (b):/home/(b)/public_html/
当我运行rsync时,我得到以下输出:
stdin: is not a tty
sending incremental file list
public_html/
deleting public_html/test.html
Number of files: 389
Number of files transferred: 0
Total file size: 3.16M bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 9.25K
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 9.33K
Total bytes received: 47
sent 9.33K bytes received 47 bytes 1.25K bytes/sec
total size is 3.16M speedup is 336.81
正如您所看到的,它表明它正在删除test.html,但它永远不会结束。任何帮助表示赞赏。
答案 0 :(得分:1)
我可以通过使用它来解决这个问题:
rsync -vhzrplt --stats --delete --rsh='/usr/bin/ssh -q' --exclude="core/" --exclude="cache/" /home/(a)/public_html/ (b):/home/(b)/public_html/
向作为文件夹的路径添加尾部斜杠。
答案 1 :(得分:1)
rsync有很多选项 - 请参阅man rsync
e.g:
--del an alias for --delete-during
--delete delete extraneous files from dest dirs
--delete-before receiver deletes before transfer (default)
--delete-during receiver deletes during xfer, not before
--delete-delay find deletions during, delete after
--delete-after receiver deletes after transfer, not before
--delete-excluded also delete excluded files from dest dirs
我们真的建议彻底阅读该手册页,因为有很多有用的选项..