Skip to content

Instantly share code, notes, and snippets.

@gokycat
Forked from pwenzel/perpetual-rsync.sh
Created September 25, 2018 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gokycat/009b83423181da2253cc78681216c2ba to your computer and use it in GitHub Desktop.
Save gokycat/009b83423181da2253cc78681216c2ba to your computer and use it in GitHub Desktop.
Automatically resume rsync over SSH after broken connection
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment