From: Lukas Schauer Date: Mon, 10 Jul 2017 19:36:10 +0000 (+0200) Subject: added hook to run before cron command (fixes #371) X-Git-Tag: v0.5.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60583d3ef9a62712851adeb488c7b454dc36ccbf;p=thirdparty%2Fdehydrated.git added hook to run before cron command (fixes #371) --- diff --git a/dehydrated b/dehydrated index d1224c7..e9e730e 100755 --- a/dehydrated +++ b/dehydrated @@ -889,6 +889,7 @@ command_account() { # Description: Sign/renew non-existent/changed/expiring certificates. command_sign_domains() { init_system + [[ -n "${HOOK}" ]] && "${HOOK}" "startup_hook" if [[ -n "${PARAM_DOMAIN:-}" ]]; then DOMAINS_TXT="$(_mktemp)" diff --git a/docs/examples/hook.sh b/docs/examples/hook.sh index 32e291b..ccf731f 100755 --- a/docs/examples/hook.sh +++ b/docs/examples/hook.sh @@ -105,14 +105,21 @@ request_failure() { # The kind of request that was made (GET, POST...) } +startup_hook() { + # This hook is called before the cron command to do some initial tasks + # (e.g. starting a webserver). + + : +} + exit_hook() { - # This hook is called at the end of a dehydrated command and can be used - # to do some final (cleanup or other) tasks. + # This hook is called at the end of the cron command and can be used to + # do some final (cleanup or other) tasks. : } HANDLER="$1"; shift -if [[ "${HANDLER}" =~ ^(deploy_challenge|clean_challenge|deploy_cert|unchanged_cert|invalid_challenge|request_failure|exit_hook)$ ]]; then +if [[ "${HANDLER}" =~ ^(deploy_challenge|clean_challenge|deploy_cert|unchanged_cert|invalid_challenge|request_failure|startup_hook|exit_hook)$ ]]; then "$HANDLER" "$@" fi