]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
call exit_hook with error message (fixes #630)
authorLukas Schauer <lukas@schauer.so>
Sun, 3 Mar 2019 19:08:18 +0000 (20:08 +0100)
committerLukas Schauer <lukas@schauer.so>
Sun, 3 Mar 2019 19:08:18 +0000 (20:08 +0100)
CHANGELOG
dehydrated
docs/examples/hook.sh

index 80d125d07e648694e208643d9f26f774b1cfc765..376be2e615e80b7eab39c7ca3af12d6569f84111 100644 (file)
--- 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
index d0cfdb4b0d7335955d2213e3a0dd749a0da57fc3..75edc62fbba3b2f48d0d6a9be8fa549a7ce7304d 100755 (executable)
@@ -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
 }
 
index 626ad3a42ef39dd9cc8492e567d5c73168682331..2cc81b744af5afc8c98e181e2a1c508e07f4e6df 100755 (executable)
@@ -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