move pre_exec part to the top

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-11-01 15:26:57 +01:00
parent 49cb1f92ee
commit ccf86defaf

View file

@ -270,6 +270,11 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
# #
( (
backup="${CSOURCES}/${name}" backup="${CSOURCES}/${name}"
c_source="${backup}/source"
c_dest="${backup}/destination"
c_pre_exec="${backup}/pre_exec"
c_post_exec="${backup}/post_exec"
# #
# Stderr to stdout, so we can produce nice logs # Stderr to stdout, so we can produce nice logs
# #
@ -296,12 +301,19 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
fi fi
# #
# Read / create configuration # First execute pre_exec, which may generate destination or other parameters
#
if [ -x "${c_pre_exec}" ]; then
_techo "Executing ${c_pre_exec} ..."
"${c_pre_exec}"; ret="$?"
_techo "Finished ${c_pre_exec} (return code ${ret})."
[ "${ret}" -eq 0 ] || _exit_err "${c_pre_exec} failed. Skipping."
fi
#
# Read source configuration
# #
c_source="${backup}/source"
c_dest="${backup}/destination"
c_pre_exec="${backup}/pre_exec"
c_post_exec="${backup}/post_exec"
for opt in verbose very_verbose summary exclude rsync_options \ for opt in verbose very_verbose summary exclude rsync_options \
delete_incomplete remote_host rsync_failure_codes \ delete_incomplete remote_host rsync_failure_codes \
mtime quiet_if_down ; do mtime quiet_if_down ; do
@ -321,17 +333,6 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
TSORT="tc" TSORT="tc"
fi fi
#
# First execute pre_exec, which may generate destination or other parameters
#
if [ -x "${c_pre_exec}" ]; then
_techo "Executing ${c_pre_exec} ..."
"${c_pre_exec}"; ret="$?"
_techo "Finished ${c_pre_exec} (return code ${ret})."
[ "${ret}" -eq 0 ] || _exit_err "${c_pre_exec} failed. Skipping."
fi
# #
# Source configuration checks # Source configuration checks
# #