From 6150ca3f200c75d902a5f61af7c99923e8a8d3aa Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Wed, 30 Dec 2009 20:04:21 +0100 Subject: ftpsync add check if RSYNC_HOST is set Signed-off-by: Joerg Jaspert --- bin/ftpsync | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/ftpsync b/bin/ftpsync index c510f36..db2ca1e 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -266,6 +266,13 @@ RSYNC_OPTIONS2=${RSYNC_OPTIONS2:-"--max-delete=40000 --delay-updates --delete -- # Which rsync share to use on our upstream mirror? RSYNC_PATH=${RSYNC_PATH:-"ftp"} +# We have no default host to sync from, but will error out if its unset +RSYNC_HOST=${RSYNC_HOST:-""} +# Error out if we have no host to sync from +if [ -z "${RSYNC_HOST}" ]; then + error "Missing a host to mirror from, please set RSYNC_HOST variable in ${BASEDIR}/etc/${NAME}.conf" +fi + # our username for the rsync share RSYNC_USER=${RSYNC_USER:-""} # the password -- cgit v1.2.3 From fc608f04f41b5a1827a636087dfe4e28912a34ef Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Wed, 30 Dec 2009 20:40:17 +0100 Subject: ftpsync update the pid written in our lockfile after backgrounding mainroutine Thanks to Kurt Roeckx for spotting this. Signed-off-by: Joerg Jaspert --- bin/ftpsync | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/ftpsync b/bin/ftpsync index db2ca1e..73b6604 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -329,7 +329,12 @@ HUB=${HUB:-"false"} # A function for the majority of the work. This function *CAN* run backgrounded. # It will be when we simply sync all. Staged syncs will not background, of course. function mainroutine() { -# Look who pushed us and note that in the log. + if [ $BASH_SUBSHELL -gt 0 ]; then + log "Mirrorrun is done backgrounded" + # Update our pid in our lockfile. Helps for the cases we go background + echo "${BASHPID}" > "${LOCK}" + fi + # Look who pushed us and note that in the log. log "Mirrorsync start" PUSHFROM="${SSH_CONNECTION%%\ *}" if [ -n "${PUSHFROM}" ]; then @@ -522,6 +527,9 @@ exec >"$LOG" 2>&1