Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comprehensive list of rsync error codes [closed]

I'm writing a script that does daily snapshots of users' home directories. First I do a dry run using:

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

and then the actual rsync operation (by removing the -n option).

I'm trying to parse the output of the dry run. Specifically, I'm interested in learning the exact cause of the rsync error (if one occurred). Does anyone know of

  1. The most common rsync errors and their codes?
  2. A link to a comprehensive rsync error code page?

Most importantly, rsync (at least on CentOs 5) does not return an error code. Rather it displays the errors internally and returns with 0. Like thus:

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] 

Has anyone had to parse rsync errors and have a suggestion on how to store the rsync return state(s)? I believe, when transferring multiple files, that errors may be raised on a per file basis and are collected at the end as shown on the last line of code above.

like image 674
seebiscuit Avatar asked Dec 23 '13 04:12

seebiscuit


People also ask

What is exit code 23?

Return code 23 means the certificate in use on the remote server is not signed by a trusted authority. This is caused by one of two things: The server is using a self-signed certificate.

What is an rsync error?

or rsync: connection unexpectedly closed (24 bytes read so far) rsync error: error in rsync protocol data stream (code 12) at io.c(342) A: This error tells you that the local rsync was trying to talk to the remote rsync, but the connection to that rsync is now gone.

Were not transferred see previous errors code 23?

Usually, the error code 23 denotes a partial transfer. This code does not provide the reason for the incomplete transfer. So, the error code 23 is basically a status code denoting an incomplete file transfer. The reason for this can be permission denial, input/output errors, typos in rsync command and so on.

What is dry run in rsync?

What is rsync –dry-run? “–dry-run” option allows the rsync command to run a trial without making any changes—most of the time, this process the same output as the real execution. The rsync command is combined with various options to specify what the rsync command will do before someone can execute it.


1 Answers

Per the rsync "man" page, here are the error codes it could return and what they mean. If you're scripting it in bash, you could look at $?

 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 

I've never seen a comprehensive "most common errors" list but I'm betting error code 1 would be at the top.

like image 76
iandouglas Avatar answered Sep 19 '22 08:09

iandouglas