29 lines
577 B
Plaintext
29 lines
577 B
Plaintext
|
#!/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 nginx)" ]; then
|
||
|
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
|