From dc7d5d614bcf07bcf53c8a5824ade450aac33b46 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Aug 2007 14:41:36 +0200 Subject: [PATCH] Reorder: first check if we should take all sources, then execute pre-exec --- ccollect.sh | 26 +++++++++++++++----------- doc/CHANGES | 1 + doc/todo/0.6 | 4 +++- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index 808b4a2..c656f16 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -93,6 +93,9 @@ export INTERVAL="$1"; shift i=1 no_sources=0 +# +# Create source "array" +# while [ "$i" -le $# ]; do eval arg=\"\$$i\" @@ -139,17 +142,6 @@ if [ "$VERBOSE" = 1 ]; then set -x fi -# -# Look for pre-exec command (general) -# -if [ -x "${CPREEXEC}" ]; then - echo "Executing ${CPREEXEC} ..." - "${CPREEXEC}"; ret=$? - echo "Finished ${CPREEXEC}." - - [ "${ret}" -eq 0 ] || _exit_err "${CPREEXEC} failed, not starting backup." -fi - # # Look, if we should take ALL sources # @@ -171,6 +163,18 @@ if [ "$ALL" = 1 ]; then done < "${TMP}" fi +# +# Look for pre-exec command (general) +# +if [ -x "${CPREEXEC}" ]; then + echo "Executing ${CPREEXEC} ..." + "${CPREEXEC}"; ret=$? + echo "Finished ${CPREEXEC}." + + [ "${ret}" -eq 0 ] || _exit_err "${CPREEXEC} exited with return-code $ret" \ + ", aborting backup." +fi + # # Need at least ONE source to backup # diff --git a/doc/CHANGES b/doc/CHANGES index fcfef5e..505ee9a 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,6 +1,7 @@ 0.5.2 to 0.5.3: * add 'exec-after-rm' (source specific) configuration * added logwrapper + * Always print return code of rsync 0.5.1 to 0.5.2: * Display correct error code, if rsync returns non-zero diff --git a/doc/todo/0.6 b/doc/todo/0.6 index 79c2941..85fd981 100644 --- a/doc/todo/0.6 +++ b/doc/todo/0.6 @@ -45,5 +45,7 @@ Documentation: - german doc? - exit pre/post exec -> error codes (after implementation!) (in 0.4) - write about fast changing fs - +- Variables: + source_$n + no_sources