From 521dc27e941f7af8ee35c264e8dc5b352d6beb33 Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Thu, 26 Apr 2012 23:56:04 -0500 Subject: Retry the sync after a delay if an upstream AUIP file is found --- bin/ftpsync | 9 +++++++-- etc/ftpsync.conf.sample | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/ftpsync b/bin/ftpsync index 85bb9c7..559200b 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -268,6 +268,8 @@ LOGROTATE=${LOGROTATE:-14} LOCK=${LOCK:-"${TO}/Archive-Update-in-Progress-${MIRRORNAME}"} # timeout for the lockfile, in case we have bash older than v4 (and no /proc) LOCKTIMEOUT=${LOCKTIMEOUT:-3600} +# sleeping time when an AUIP file is found but is not ours +UIPSLEEP=${UIPSLEEP:-1200} # Do we need another rsync run? UPDATEREQUIRED="${TO}/Archive-Update-Required-${MIRRORNAME}" # Trace file for mirror stats and checks (make sure we get full hostname) @@ -503,8 +505,11 @@ while [ -e "${UPDATEREQUIRED}" ]; do done if $upstream_uip; then - log "Upstream archive update in progress, skipping stage2 (ignore rsync error below)" - result=1 + log "Upstream archive update in progress, skipping stage2" + log "Retrying update in ${UIPSLEEP}" + touch "${UPDATEREQUIRED}" + sleep "${UIPSLEEP}" + result=0 else log "Running stage2: ${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} ${RSYNCPTH}::${RSYNC_PATH} ${TO}" diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample index e3fcc63..9e8cc65 100644 --- a/etc/ftpsync.conf.sample +++ b/etc/ftpsync.conf.sample @@ -89,6 +89,10 @@ ## synced mirror even if we get multiple pushes in a short timeframe #UPDATEREQUIRED="${TO}/Archive-Update-Required-${MIRRORNAME}" +## Number of seconds to sleep before retrying to sync whenever upstream +## is found to be updating while our update is running +#UIPSLEEP=1200 + ## The trace file is used by a mirror check tool to see when we last ## had a successful mirror sync. Make sure that it always ends up in ## project/trace and always shows the full hostname. -- cgit v1.2.3