Skip to content

Instantly share code, notes, and snippets.

@csghone
Last active September 9, 2022 03:18
Show Gist options
  • Save csghone/b620fc1e82b053ecf083dbdf0baecf5f to your computer and use it in GitHub Desktop.
Save csghone/b620fc1e82b053ecf083dbdf0baecf5f to your computer and use it in GitHub Desktop.
RSYNC on bad networks
# Sample command:
# rsync_on_flaky_networks.sh 192.168.101.102:logs_20200706* dst_folder/
SRC="$1"
DST="$2"
if [ "$SRC" == "" ]; then
echo "Invalid arguments. Usage: $0 <SRC> <DST>"
fi
if [ "$DST" == "" ]; then
echo "Invalid arguments. Usage: $0 <SRC> <DST>"
fi
while [ true ];
do
timeout 60 rsync --append --append-verify --partial -avz --timeout=60 "$SRC" "$DST" --progress;
if [ $? -eq 0 ];then
break;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment