rsync错误代码的完整列表

饼干

我正在编写一个脚本,对用户的主目录进行每日快照。首先,我使用以下方法进行试运行:

rsync -azvrn --out-format="%M %f" source/dir dest/dir

然后是实际的rsync操作(通过删除该-n选项)。

我正在尝试解析空运行的输出。具体来说,我有兴趣了解rsync错误(如果发生)的确切原因。有谁知道

  1. 最常见的rsync错误及其代码?
  2. 链接到全面的rsync错误代码页面?

最重要的是,rsync(至少在CentO 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返回状态的建议?我相信,当传输多个文件时,可能会在每个文件的基础上引发错误,并且错误会在上面的最后一行所示的结尾处收集。

安道格拉斯:

在rsync“ man”页面上,这是它可能返回的错误代码及其含义。如果您使用bash编写脚本,可以看看$?

 0     Success
 1     Syntax or usage error
 2     Protocol incompatibility
 3     Errors selecting input/output files, dirs
 4     Requested action not supported: an attempt was made to manipulate 64-bit
       files on a platform that cannot support them; or an option was specified
       that is supported by the client and not by the server.
 5     Error starting client-server protocol
 6     Daemon unable to append to log-file
10     Error in socket I/O
11     Error in file I/O
12     Error in rsync protocol data stream
13     Errors with program diagnostics
14     Error in IPC code
20     Received SIGUSR1 or SIGINT
21     Some error returned by waitpid()
22     Error allocating core memory buffers
23     Partial transfer due to error
24     Partial transfer due to vanished source files
25     The --max-delete limit stopped deletions
30     Timeout in data send/receive
35     Timeout waiting for daemon connection

我从未见过全面的“最常见错误”列表,但我敢打赌错误代码1会位于顶部。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章