Skip to content

Instantly share code, notes, and snippets.

@mrladeia
Created June 24, 2016 02:37
Show Gist options
  • Save mrladeia/4f0e90036ef68a592d1354100c4c85de to your computer and use it in GitHub Desktop.
Save mrladeia/4f0e90036ef68a592d1354100c4c85de to your computer and use it in GitHub Desktop.
Rsync reconnect automatically. Require sshpass (or no)
#!/bin/bash
while [ 1 ]
do
sshpass -p "PASSWORD" rsync --ignore-existing -r USER@HOST:/path/from/host /path/to/local -v --progress --stats
if [ "$?" = "0" ] ; then
echo "RSYNC FINISH"
exit
else
echo "RSYNC FAIL. WAIT, RECONNECTING..."
sleep 5
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment