【发布时间】:2014-01-11 07:09:08
【问题描述】:
我正在编写一个脚本,用于对用户的主目录进行每日快照。首先,我使用以下方法进行试运行:
rsync -azvrn --out-format="%M %f" source/dir dest/dir
然后是实际的 rsync 操作(通过删除 -n 选项)。
我正在尝试解析试运行的输出。具体来说,我有兴趣了解 rsync 错误(如果发生)的确切原因。有谁知道
- 最常见的 rsync 错误及其代码?
- 一个全面的 rsync 错误代码页面的链接?
最重要的是,rsync(至少在 CentOs 5 上)不会返回错误代码。而是在内部显示错误并返回 0。就像这样:
sending incremental file list
rsync: link_stat "/data/users/gary/testdi" failed: No such file or directory (2)
sent 18 bytes received 12 bytes 60.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
有没有人必须解析 rsync 错误并对如何存储 rsync 返回状态提出建议?我相信,在传输多个文件时,可能会在每个文件的基础上引发错误,并在最后收集,如上面最后一行代码所示。
【问题讨论】:
标签: linux rsync error-code