I'm trying to syncronize files from a remote server that is not reliable, meaning the connection tends to fail "randomly" with
rsync: connection unexpectedly closed
Rsync is called with –partial, so I'd like to be able to call rsync in a loop until files are fully transfered. There doesn't seem to be a flag to tell rsync to retry.
What would be the best way to script it? A bash for loop?
Best Answer
If you are syncing everything in one sync, call rsync in a loop until rsync gives you a successful return code.
Something like:
This will loop, calling rsync, until it gives a return code of 0. You may want to add a sleep in there to keep from DOSing your server.