Created
August 12, 2021 16:39
-
-
Save AlekseySpiridonov/8c8ff6d98870782b78402863faa41ddc to your computer and use it in GitHub Desktop.
MacOS rsync with retries every 120 seconds
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 | |
ADDITIONAL_KEYS="" | |
if [ ! -z "${3}" ] | |
then | |
ADDITIONAL_KEYS="${3}" | |
fi | |
echo "===============================" | |
echo "===== CUSTOM RSYNC SCRIPT =====" | |
echo "===============================" | |
echo 'Sync '$1' to '$2 | |
echo "With params:""${ADDITIONAL_KEYS}" | |
echo "===============================" | |
while [ 1 ] | |
do | |
rsync -Pav --rsh ssh --partial --exclude="*.icloud" --exclude=".DS_Store" $ADDITIONAL_KEYS "${1}" "${2}" | |
if [ "$?" = "0" ] ; then | |
echo "===============================" | |
echo "====== C O M P L E T E D ======" | |
echo "===============================" | |
exit | |
else | |
echo "-------------------------------------------" | |
echo "Rsync failure. Backing off and retrying... " | |
echo "-------------------------------------------" | |
sleep 120 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment