summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2008-11-17 21:02:11 +0100
committerJoerg Jaspert <joerg@debian.org>2008-11-17 21:02:11 +0100
commit738e371884099841c166322b0263739c32890b50 (patch)
tree803260631acbf5beae059c9e71c552e056323c0a
parent2fde2246b43269ccba8e8773be9e49b3a04ed0a1 (diff)
ftpsync
handle "file missing"/"partial transfer" errors better, in case we already have a second push. We might just have tried to receive files that the second push removed. Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/ftpsync22
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 0378add..9421af2 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -132,6 +132,8 @@ check_rsync() {
case "${ret}" in
0) return 0;;
24) return 0;;
+ 23) return 2;;
+ 30) return 2;;
*)
error "ERROR: ${msg}"
return 1
@@ -391,7 +393,15 @@ while [ -e "${UPDATEREQUIRED}" ]; do
fi # Sync stage 1?
rm -f "${UPDATEREQUIRED}"
- check_rsync $result "Sync step 1 went wrong, got errorcode ${result}. Logfile: ${LOG}" || exit 3
+ set +e
+ check_rsync $result "Sync step 1 went wrong, got errorcode ${result}. Logfile: ${LOG}"
+ GO=$?
+ set -e
+ if [ ${GO} -eq 2 ] && [ -e "${UPDATEREQUIRED}" ]; then
+ log "We got error ${result} from rsync, but a second push went in hence ignoring this error for now"
+ elif [ ${GO} -ne 0 ]; then
+ exit 3
+ fi
HOOK=(
HOOKNR=2
@@ -417,7 +427,15 @@ while [ -e "${UPDATEREQUIRED}" ]; do
result=0
fi # Sync stage 2?
- check_rsync $result "Sync step 2 went wrong, got errorcode ${result}. Logfile: ${LOG}" || exit 4
+ set +e
+ check_rsync $result "Sync step 2 went wrong, got errorcode ${result}. Logfile: ${LOG}"
+ GO=$?
+ set -e
+ if [ ${GO} -eq 2 ] && [ -e "${UPDATEREQUIRED}" ]; then
+ log "We got error ${result} from rsync, but a second push went in hence ignoring this error for now"
+ elif [ ${GO} -ne 0 ]; then
+ exit 4
+ fi
HOOK=(
HOOKNR=3