evoacme: add dovecot hook
This commit is contained in:
parent
b0df53a6ee
commit
0ef627e4bd
32
evoacme/files/hooks/reload_dovecot
Executable file
32
evoacme/files/hooks/reload_dovecot
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
readonly PROGNAME=$(basename "$0")
|
||||||
|
readonly ARGS=$@
|
||||||
|
|
||||||
|
readonly VERBOSE=${VERBOSE:-"0"}
|
||||||
|
readonly QUIET=${QUIET:-"0"}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
>&2 echo "${PROGNAME}: $1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
debug() {
|
||||||
|
if [ "${VERBOSE}" = "1" ] && [ "${QUIET}" != "1" ]; then
|
||||||
|
>&2 echo "${PROGNAME}: $1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$(pidof dovecot)" ]; then
|
||||||
|
if $($(command -v doveconf) > /dev/null); then
|
||||||
|
if $($(command -v doveconf)|grep -E "^ssl_cert[^_]"|grep -q "letsencrypt"); then
|
||||||
|
debug "Dovecot detected... reloading"
|
||||||
|
service dovecot reload
|
||||||
|
else
|
||||||
|
debug "Dovecot doesn't use Let's Encrypt certificate. Skip."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
error "Dovecot config is broken, you must fix it !"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
debug "Dovecot is not running. Skip."
|
||||||
|
fi
|
Loading…
Reference in a new issue