fix order of restic job hooks

This commit is contained in:
2019-12-25 17:23:36 -06:00
parent 07a5dd96b2
commit e44e06594e
2 changed files with 20 additions and 15 deletions

View File

@ -53,7 +53,11 @@ printf "job '%s' started\n" "$JOB"
if [ -d "${HOOKS_PATH}" ]; then
printf "running '%s' job pre-hooks\n" "$JOB"
run-parts -v -a pre "${HOOKS_PATH}"
if ! run-parts --exit-on-error -v -a pre "${HOOKS_PATH}"; then
printf "'%s' pre-hooks failed, running post-hooks and exiting\n" "$JOB"
run-parts --exit-on-error -v -a post "${HOOKS_PATH}"
exit 1
fi
fi
counter=0
@ -86,5 +90,5 @@ fi
if [ -d "${HOOKS_PATH}" ]; then
printf "running '%s' job post-hooks\n" "$JOB"
run-parts -v -a post "${HOOKS_PATH}"
run-parts --exit-on-error -v -a post "${HOOKS_PATH}"
fi