From 5533b44c10b35725d13276b1d7f3194250ac4add Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 28 Dec 2009 16:47:20 +0100 Subject: ftpsync. call runmirrors with getopts args call runmirrors with the getopts args it has now. always present -a and -f. only set -s and -k when appropriate. Signed-off-by: Joerg Jaspert --- bin/ftpsync | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'bin') diff --git a/bin/ftpsync b/bin/ftpsync index b6d9d95..2808d34 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -458,18 +458,33 @@ function mainroutine() { rm -f "${LOCK}" if [ x${HUB} = "xtrue" ]; then - # Only trigger slave mirrors if we had a push for stage2 or all - if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then - log "Trigger slave mirrors" - ${BASEDIR}/bin/runmirrors "${ARCHIVE}" - log "Trigger slave done" - - HOOK=( - HOOKNR=5 - HOOKSCR=${HOOK5} - ) - hook $HOOK - fi + # Trigger slave mirrors if we had a push for stage2 or all, or if its mhop + if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ] || [ "xtruex" = "x${SYNCMHOP}x" ]; then + # We tell runmirrors about the archive we are running on. Might be empty. + RUNMIRRORARGS="-a ${ARCHIVE}" + # We also tell runmirrors that we are running it from within ftpsync, so it can change + # the way it works with mhop based on that. + RUNMIRRORARGS="${RUNMIRRORARGS} -f" + + if [ "xtruex" = "x${SYNCSTAGE1}x" ]; then + # This is true when we have a mhop sync. And only then, due to the earlier if. + # So if that happens, tell runmirrors we are doing mhop stage1. + RUNMIRRORARGS="${RUNMIRRORARGS} -s stage1 -k mhop" + elif [ "xtruex" = "x${SYNCSTAGE2}x" ]; then + RUNMIRRORARGS="${RUNMIRRORARGS} -s stage2" + elif [ "xtruex" = "x${SYNCALL}x" ]; then + RUNMIRRORARGS="${RUNMIRRORARGS} -s all" + fi + log "Trigger slave mirrors" + ${BASEDIR}/bin/runmirrors "${RUNMIRRORARGS}" + log "Trigger slave done" + + HOOK=( + HOOKNR=5 + HOOKSCR=${HOOK5} + ) + hook $HOOK + fi fi # All done, lets call cleanup -- cgit v1.2.3