retry transfer

This commit is contained in:
Vincent Riquer 2012-02-09 17:17:58 +01:00
parent ea72b4d2dd
commit c128c5c7a4

View File

@ -74,6 +74,8 @@ done
declare -a failedBackups declare -a failedBackups
declare -A failedWith declare -A failedWith
RETRY=5
RETRY_DELAY=60
failRsync() { failRsync() {
nameFailed="$1" nameFailed="$1"
@ -208,13 +210,34 @@ runBackup() {
RSYNC_OPTS="$RSYNC_OPTS --timeout=1800" RSYNC_OPTS="$RSYNC_OPTS --timeout=1800"
fi fi
$RSYNC \ for (( try=1 ; try <= RETRY ; try++ ))
$RSYNC_OPTS \ do
$ADDITIONAL_RSYNC_OPTS \ $RSYNC \
"${REMOTE_LOCATION}" \ $RSYNC_OPTS \
"$SNAPSHOT_RW/$NAME/$1" $ADDITIONAL_RSYNC_OPTS \
"${REMOTE_LOCATION}" \
"$SNAPSHOT_RW/$NAME/$1"
returncode=$?
case $returncode in
0)
break
;;
2)
break
;;
*)
cat <<-EOF
Trial $try / $RETRY failed.
Sleeping $RETRY_DELAY...
EOF
sleep $RETRY_DELAY
;;
esac
done
returncode=$?
case $returncode in case $returncode in
0) 0)
: :