Created
June 3, 2020 09:36
-
-
Save iRhonin/5aa84c101c15998fc7562aa17f8b1056 to your computer and use it in GitHub Desktop.
Auto Reconnect Rsync
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 | |
echo -e "Please enter the full (escaped) file path:" | |
read -r path | |
echo "Path: $path" | |
echo -e "Enter the destination:" | |
read -r dst | |
echo "Destination: $dst" | |
while [ 1 ] | |
do | |
rsync --progress --partial --delete -az -e ssh "USER@HOST:$path" $dst | |
if [ "$?" = "0" ] ; then | |
echo "rsync completed normally" | |
exit | |
else | |
echo "rsync failure. Retrying in a minute..." | |
sleep 60 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment