How to repeatedly call rsync until files are sucessfully transferred
If you are syncing everything in one sync, call rsync in a loop until rsync gives you a successful return code.
RC=1 while [[ $RC -ne 0 ]] do rsync -a ..... RC=$? done
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.
I ran into this same problem a while back. In the end I wrote something similar to David's answer, but gussied it up a little with max retries, responding to Ctrl-C, and such: http://blog.iangreenleaf.com/2009/03/rsync-and-retrying-until-we-get-it.html.
purtting it all together with sshpass
while ! sshpass -p 'xxxx' rsync --partial --append-verify --progress -a -e 'ssh -p 22' /source/ [email protected]:/dest/; do sleep 5;done