From 738e371884099841c166322b0263739c32890b50 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 17 Nov 2008 21:02:11 +0100 Subject: 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 --- bin/ftpsync | 22 ++++++++++++++++++++-- 1 file 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 -- cgit v1.2.3