summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Geissert <atomo64@gmail.com>2012-04-26 23:56:04 -0500
committerRaphael Geissert <atomo64@gmail.com>2012-04-26 23:56:04 -0500
commit521dc27e941f7af8ee35c264e8dc5b352d6beb33 (patch)
tree03045404b0d3245bc2e77480e179be0276f542e7
parentf56f99e06c75697526dfbcaf2594461d6f489922 (diff)
Retry the sync after a delay if an upstream AUIP file is found
-rwxr-xr-xbin/ftpsync9
-rw-r--r--etc/ftpsync.conf.sample4
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.