当 rsync 成功完成时,它的输出是什么样的?

当 rsync 成功完成时,它的输出是什么样的?

昨晚我使用 rsync 将主驱动器备份到外部驱动器。晚上的某个时候,外部驱动器被拔掉了。这是输出的尾部rsync -avRP

...
/media/winter14/flickr/ren_desktop/test1.py
        1945 100%   12.18kB/s    0:00:00 (xfer#474913, to-check=2/1256522)
/media/winter14/flickr/ren_desktop/test_start.py
         445 100%    2.73kB/s    0:00:00 (xfer#474914, to-check=1/1256522)
/media/winter14/flickr/ren_desktop/time-test.py
        2494 100%   14.94kB/s    0:00:00 (xfer#474915, to-check=0/1256522)

sent 79538570122 bytes  received 11368753 bytes  11208163.28 bytes/sec
total size is 191343688116  speedup is 2.41

这个输出是否表明 rsync 成功完成?

答案1

您的输出仅表明rsync已完成且未崩溃。要了解更多信息,您需要其退出状态。

如果完成后你没有在该 shell 中运行任何其他命令rsync,则可以使用以下命令获取最后一个命令的退出状态:

echo $?

rsync可以返回许多不同的退出代码来告诉你发生了什么。以下是其手册页的摘录:

   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

相关内容