2017-10-19 22:21:18 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
readonly PROGNAME=$(basename "$0")
|
2020-04-16 09:44:25 +02:00
|
|
|
# shellcheck disable=SC2124,SC2034
|
2017-10-19 22:21:18 +02:00
|
|
|
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 apache2)" ]; then
|
2020-04-16 09:44:25 +02:00
|
|
|
# shellcheck disable=SC2091
|
2017-10-19 22:21:18 +02:00
|
|
|
if $($(command -v apache2ctl) -t 2> /dev/null); then
|
|
|
|
debug "Apache detected... reloading"
|
|
|
|
service apache2 reload
|
|
|
|
else
|
|
|
|
error " Apache config is broken, you must fix it !"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
debug "Apache is not running. Skip."
|
|
|
|
fi
|