From c8b0797f49ed9af655f5c7a6e57ffd2075fdb293 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 28 Dec 2009 16:22:48 +0100 Subject: ftpsync add new option sync:mhop Signed-off-by: Joerg Jaspert --- bin/ftpsync | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index c510f36..b6d9d95 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -56,6 +56,7 @@ VERSION="80286" # stage1 Only do stage1 sync # stage2 Only do stage2 sync # all Do a complete sync +# mhop Do a mhop sync, usually additionally to stage1 # archive:foo Sync archive foo (if config for foo is available) # callback Call back when done (needs proper ssh setup for this to # work). It will always use the "command" callback:$HOSTNAME @@ -89,6 +90,9 @@ check_commandline() { sync:all) SYNCALL="true" ;; + sync:mhop) + SYNCMHOP="true" + ;; *) echo "Unknown option ${1} ignored" ;; @@ -280,6 +284,8 @@ SYNCSTAGE1=${SYNCSTAGE1:-"false"} SYNCSTAGE2=${SYNCSTAGE2:-"false"} # Do we sync all? SYNCALL=${SYNCALL:-"true"} +# Do we have a mhop sync? +SYNCMHOP=${SYNCMHOP:-"false"} # Do we callback? SYNCCALLBACK=${SYNCCALLBACK:-"false"} # If we call back we need some more options defined in the config file. -- cgit v1.2.3 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/ftpsync') 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 From 8705fdd787775366c3d3e5795f9428e24720e5a4 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 28 Dec 2009 22:31:45 +0100 Subject: ftpsync call runmirrors with the correct argument set Signed-off-by: Joerg Jaspert --- bin/ftpsync | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index 2808d34..5e127cd 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -467,13 +467,14 @@ function mainroutine() { 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" + # This is true when we have a mhop sync. A normal multi-stage push sending stage1 will + # not get to this point. + # So if that happens, tell runmirrors we are doing mhop + RUNMIRRORARGS="${RUNMIRRORARGS} -k mhop" elif [ "xtruex" = "x${SYNCSTAGE2}x" ]; then - RUNMIRRORARGS="${RUNMIRRORARGS} -s stage2" + RUNMIRRORARGS="${RUNMIRRORARGS} -k stage2" elif [ "xtruex" = "x${SYNCALL}x" ]; then - RUNMIRRORARGS="${RUNMIRRORARGS} -s all" + RUNMIRRORARGS="${RUNMIRRORARGS} -k all" fi log "Trigger slave mirrors" ${BASEDIR}/bin/runmirrors "${RUNMIRRORARGS}" -- cgit v1.2.3 From 537ed442d099e95a3831a7d2ce1496f725f310b1 Mon Sep 17 00:00:00 2001 From: Uli Martens Date: Tue, 29 Dec 2009 18:11:20 +0100 Subject: fix whitespace to minimize diff between master and mhop branches Signed-off-by: Joerg Jaspert --- bin/ftpsync | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index 5e127cd..0d5a2ed 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -458,34 +458,34 @@ function mainroutine() { rm -f "${LOCK}" if [ x${HUB} = "xtrue" ]; then - # 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. A normal multi-stage push sending stage1 will - # not get to this point. - # So if that happens, tell runmirrors we are doing mhop - RUNMIRRORARGS="${RUNMIRRORARGS} -k mhop" - elif [ "xtruex" = "x${SYNCSTAGE2}x" ]; then - RUNMIRRORARGS="${RUNMIRRORARGS} -k stage2" - elif [ "xtruex" = "x${SYNCALL}x" ]; then - RUNMIRRORARGS="${RUNMIRRORARGS} -k all" - fi - log "Trigger slave mirrors" - ${BASEDIR}/bin/runmirrors "${RUNMIRRORARGS}" - 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. A normal multi-stage push sending stage1 will + # not get to this point. + # So if that happens, tell runmirrors we are doing mhop + RUNMIRRORARGS="${RUNMIRRORARGS} -k mhop" + elif [ "xtruex" = "x${SYNCSTAGE2}x" ]; then + RUNMIRRORARGS="${RUNMIRRORARGS} -k stage2" + elif [ "xtruex" = "x${SYNCALL}x" ]; then + RUNMIRRORARGS="${RUNMIRRORARGS} -k 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 From f5aba53bbbb602693a2ece17cb271be507c3c5fd Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Wed, 30 Dec 2009 21:24:18 +0100 Subject: ftpsync tracefile only update the tracefile if it is a stage2 or all sync Signed-off-by: Joerg Jaspert --- bin/ftpsync | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index d016f89..ce77a21 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -448,10 +448,14 @@ function mainroutine() { hook $HOOK done - if [ -d "`dirname "${TO}/${TRACE}"`" ]; then - LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}" - echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}" - echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}" + # We only update our tracefile when we had a stage2 or an all sync. + # Otherwise we would update it after stage1 already, which is wrong. + if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then + if [ -d "`dirname "${TO}/${TRACE}"`" ]; then + LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}" + echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}" + echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}" + fi fi HOOK=( -- cgit v1.2.3 From 52438f4293c217998f359f617f3055d3039ea63b Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Thu, 31 Dec 2009 15:24:40 +0100 Subject: ftpsync only set -a argument for runmirrors when it actually has one Signed-off-by: Joerg Jaspert --- bin/ftpsync | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index ce77a21..1af9348 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -476,8 +476,11 @@ function mainroutine() { if [ x${HUB} = "xtrue" ]; then # 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}" + RUNMIRRORARGS="" + if [ -n "${ARCHIVE}" ]; then + # We tell runmirrors about the archive we are running on. + RUNMIRRORARGS="-a ${ARCHIVE}" + fi # 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" -- cgit v1.2.3 From c7ecee0e9700f796ab63388a60095c478952eb82 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Thu, 31 Dec 2009 16:26:36 +0100 Subject: ftpsync, runmirrors fixup calling of runmirrors log more what we are supposed to do Signed-off-by: Joerg Jaspert --- bin/ftpsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index 1af9348..98f80d4 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -496,7 +496,7 @@ function mainroutine() { RUNMIRRORARGS="${RUNMIRRORARGS} -k all" fi log "Trigger slave mirrors" - ${BASEDIR}/bin/runmirrors "${RUNMIRRORARGS}" + ${BASEDIR}/bin/runmirrors ${RUNMIRRORARGS} log "Trigger slave done" HOOK=( -- cgit v1.2.3