]> git.street.me.uk Git - andy/dehydrated.git/blobdiff - dehydrated
Adding the request_failure hook (#326)
[andy/dehydrated.git] / dehydrated
index 7223fed124e8eb2691ba3a30aec75f6476a02724..dc9265ef6ad4571ffa174f3eec94713f92d169cd 100755 (executable)
@@ -366,6 +366,13 @@ http_request() {
     cat "${tempcont}" >&2
     echo >&2
     echo >&2
+
+    # An exclusive hook for the {1}-request error might be useful (e.g., for sending an e-mail to admins)
+    if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" != "yes" ]]; then
+      errtxt=`cat ${tempcont}`
+      "${HOOK}" "request_failure" "${statuscode}" "${errtxt}" "${1}"
+    fi
+
     rm -f "${tempcont}"
 
     # Wait for hook script to clean the challenge if used