Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working to implement a log backup solution which is going to rely on using rsync to move data off of a local server and on to a remote logging server. We have two concerns - the first is that as of now I have not implemented any logging which needs to be done. The man page for rsync is huge, and we're not using an rsync server, just an oncall rsync to push data from the client (client initiated) to the storage server.

Off the top of anyones head, are there any logging options for failures mid transfer, or anything like that?

Also, due to the nature of how we are implementing it, the shell script first tries to ping the the local backup server. If the ping is successful, it uploads the files. However, if the ping is unsuccessful, it will instead upload to a georedundant backup server. This leaves a hole if the main server goes down midway through the rsync. Is there any way to specify a backup destination in the case of a failure mid transfer?

share|improve this question

I don't think rsync has any builtin failover options or special error logging (other than what's printed to stderr). It does have --log-file= and --log-file-format= options, but these concentrate on logging what files were updated, not connection failures. What I'd recommend is on the client side, check the exit status of rsync, and if it's an error number that indicates a connection problem (it looks like 10, 12, and 30 are the relevant ones, but testing will give you a better idea) scan for another reachable server and retry. You can also capture rsync's stderr output, and either log that directly or scan it for recognized errors and summarize them in your log.

If you want logging on the server side as well, I'd write a wrapper script that runs rsync normally (rsync "$@" to pass through arguments), then checks its exit status and logs that. Make sure your script doesn't output anything (to stdout or stderr) itself, or it may confuse the remote rsync client.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.