4 ms·
I've written a script that every minute tests to see if the appropriate rsync command is running. If not, it simply runs it again. In that way it effectively
by CarolineW 10y ago
I've written a script that every minute tests to see if the appropriate rsync command is running. If not, it simply runs it again. In that way it effectively restarts and gracefully resumes.
This Google search:
https://www.google.co.uk/search?q=rsync+auto-restart+failed+connection https://www.google.co.uk/search?q=rsync+auto-restart+failed+...
returns this link:
http://superuser.com/questions/302842/resume-rsync-over-ssh-after-broken-connection http://superuser.com/questions/302842/resume-rsync-over-ssh-...
which contains this script:
#!/bin/bash
while [ 1 ]
do
rsync -avz --partial source dest
if [ "$?" = "0" ] ; then
echo "rsync completed normally"
exit
else
echo "Rsync failure. Backing off and retrying..."
sleep 180
fi
done
The comment says:
When the connection dies, rsync will quit
with a non-zero exit code. This script simply
keeps re-running rsync, letting it continue
until the synchronisation completes normally.
That's pretty much what I've done.
- kraemate 10y agoWow, thanks for the script. Surprising in its simplicity. I would have thought this use-case was popular enough to warrant specialized tools etc. Especially in the scientific community where they transfer large files.
- CarolineW 10y agoIt's simple enough that it's the sort of thing I type out in 30 seconds and there it is. No need for specialist tools - finding the tool, remembering how to use it, working out the right parameters ... Easier, faster, and more flexible just to write the script. It's what I do.