Reorder: first check if we should take all sources, then execute pre-exec

This commit is contained in:
Nico Schottelius 2007-08-14 14:41:36 +02:00
parent 30352b83a8
commit dc7d5d614b
3 changed files with 19 additions and 12 deletions

View File

@ -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
#

View File

@ -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

View File

@ -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