diff --git a/CHANGELOG b/CHANGELOG index 80d125d..376be2e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ This file contains a log of major changes in dehydrated ## Changed - OCSP refresh interval is now configurable - Implemented POST-as-GET +- Call exit_hook on errors (with error-message as first parameter) ## Added - Initial support for tls-alpn-01 validation diff --git a/dehydrated b/dehydrated index d0cfdb4..75edc62 100755 --- a/dehydrated +++ b/dehydrated @@ -432,6 +432,7 @@ _sed() { # Print error message and exit with error _exiterr() { echo "ERROR: ${1}" >&2 + [[ -n "${HOOK:-}" ]] && "${HOOK}" "exit_hook" "${1}" || true exit 1 } diff --git a/docs/examples/hook.sh b/docs/examples/hook.sh index 626ad3a..2cc81b7 100755 --- a/docs/examples/hook.sh +++ b/docs/examples/hook.sh @@ -178,10 +178,14 @@ startup_hook() { } exit_hook() { + local ERROR="${1:-}" + # This hook is called at the end of the cron command and can be used to # do some final (cleanup or other) tasks. - - : + # + # Parameters: + # - ERROR + # Contains error message if dehydrated exits with error } HANDLER="$1"; shift