2019-09-27 00:13:30 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-09-27 10:15:33 +02:00
|
|
|
readonly PROGNAME=$(basename "$0")
|
2019-09-27 00:13:30 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-09-27 09:31:22 +02:00
|
|
|
apache2ctl_bin=$(command -v apache2ctl)
|
|
|
|
|
|
|
|
if [ -n "$(pidof apache2)" ] && [ -n "${apache2ctl_bin}" ]; then
|
2019-09-27 10:15:33 +02:00
|
|
|
if grep -q -r -E "letsencrypt" /etc/apache2/; then
|
|
|
|
if ${apache2ctl_bin} configtest > /dev/null 2>&1; then
|
2019-09-27 00:13:30 +02:00
|
|
|
debug "Apache detected... reloading"
|
|
|
|
systemctl reload apache2
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
error "Apache config is broken, you must fix it !"
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
debug "Apache doesn't use Let's Encrypt certificate. Skip."
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
debug "Apache is not running or missing. Skip."
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|