forked from evolix/ansible-roles
31 lines
644 B
Bash
Executable file
31 lines
644 B
Bash
Executable file
#!/bin/sh
|
|
|
|
readonly PROGNAME=$(basename "$0")
|
|
# shellcheck disable=SC2124,SC2034
|
|
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 nginx)" ]; then
|
|
# shellcheck disable=SC2091
|
|
if $($(command -v nginx) -t 2> /dev/null); then
|
|
debug "Nginx detected... reloading"
|
|
service nginx reload
|
|
else
|
|
error "Nginx config is broken, you must fix it !"
|
|
fi
|
|
else
|
|
debug "Nginx is not running. Skip."
|
|
fi
|