summaryrefslogtreecommitdiff
path: root/bin/ftpsync
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ftpsync')
-rwxr-xr-xbin/ftpsync10
1 files changed, 9 insertions, 1 deletions
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 </dev/null
if [ "xtruex" = "x${SYNCALL}x" ]; then
# We have a simple normal mirror run, not staged. Lets background it.
mainroutine &
+ # Wait 2 seconds before we exit, then the ${LOCK} for sure has the pid
+ # of the mainroutine in it
+ sleep 2
else
# Staged run, we have to wait until we are done before we exit, uplink
# is using that for synchronisation