getting stats from rsync after a failure
With the --stats option, rsync produces some nice statistics at the end of the run. However, if there is a failure of some kind, it won't output those stats.
I'm running backups from machines in one network to machines in another. There is a fixed window of time these backups are allowed to run. At the end of the window of time, the backups must end. Anything not backed up this day will have to wait for the next day.
I have used 2 different methods for restricting the backups to the time window. The first was the "timelimit" command. It was awkward because it used an interval, not an absolute time. I was necessary to calculate the interval in the script itself each time rsync was run (it might be run more than once in the same window to first backup priority files, then backup normal files, under different include/exclude rules). The second was to apply the "timelimit" command to the ssh client that sets up the port forwarding over which the backups are run. This works more smoothly because no matter how many times rsync tries to run for a given backup, the ssh port forward is there only during the intended time window.
The problem with rsync happens in both cases. In the first it is rsync itself that gets the SIGTERM signal from timelimit. In the second ssh gets the SIGTERM and rsync only sees a connection lost (or a connection refused when it retries).
The problem is that with either condition of failure (received SIGTERM or connection lost), the statistics requested by --stats is NOT output. Is there any way to get these statistics to be output, at least in the case of a lost connection?
|