Created
June 24, 2016 02:37
-
-
Save mrladeia/4f0e90036ef68a592d1354100c4c85de to your computer and use it in GitHub Desktop.
Rsync reconnect automatically. Require sshpass (or no)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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