rsync to retry if copy failed - possible?

Eberhard Moenkeberg emoenke at gwdg.de
Sat Dec 11 21:28:28 GMT 2004


Hi,

On Sat, 11 Dec 2004, Tomasz Chmielewski wrote:
> Eberhard Moenkeberg wrote:
> > On Sat, 11 Dec 2004, Tomasz Chmielewski wrote:

> > > I want to be 100% sure that rsync copies something from one location to
> > > another.
> > > 
> > > However, I did not see an option which would make rsync retry an operation
> > > if
> > > it failed for whatever reason (network was down when rsync started, or
> > > network
> > > went down during rsync was copying something, connection timed out etc.).
> > > 
> > > For example, wget has an option like --tries=number Set number of retries
> > > to
> > > number.  Specify 0 or inf for infinite retrying.
> > > 
> > > Is there something similar in rsync? If not, are there any ways to achieve
> > > a
> > > similar behaviour?
> > 
> > 
> > rsync has a very differentiated set of return codes.
> 
> So is it really the only way?
> 
> Restarting rsync if the exit code was different than 0 (success) means it has
> to recalculate everything again.
> With archives when there are a lot of files this means waste of time, CPU etc.

I see, but...

> Are there any other options?

An option "retry n times" would make sense only for some very special 
situations. I am not sure if there are some, but you surely have to do a 
full restart-from-beginning if the other side does not respond any longer.

And "retry n times" would make no sense in almost all cases of other 
errors where rsync currently is aborting the whole thing...

So I guess it is up to find concrete situations next where the idea would 
make sense in practice.

Error code 12 subcase "max sessions" looks like a candidate, but you win
an entry in the server admin's /etc/hosts.deny if you do not pause at that 
point.
  
Cheers -e
-- 
Eberhard Moenkeberg (emoenke at gwdg.de, em at kki.org)


More information about the rsync mailing list