From d78bf0381f86d80fd06ca7f0818003afc09c26ec Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 21 Jan 2016 10:16:40 -0500 Subject: apache2.initd: apply default values for conf.d variables in one place. There are a few variables in the apache2 conf.d file that have default values. The default values were applied at various places in different commands, and often more than once. Since none of those variables need to be modified after the script has loaded, it makes more sense to set them once at the beginning of the script. --- 2.4/init/apache2.initd | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/2.4/init/apache2.initd b/2.4/init/apache2.initd index 0a1e6a0..50b6500 100755 --- a/2.4/init/apache2.initd +++ b/2.4/init/apache2.initd @@ -15,6 +15,13 @@ description_reload="Kills all children and reloads the configuration." description_virtualhosts="Show the settings as parsed from the config file (currently only shows the virtualhost settings)." description_stop="Kills all children and stops the server." +# Apply default values for some conf.d variables. +PIDFILE="${PIDFILE:-/var/run/apache2.pid}" +TIMEOUT=${TIMEOUT:-15} +SERVERROOT="${SERVERROOT:-/usr/lib/apache2}" +CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" +RELOAD_TYPE="${RELOAD_TYPE:-graceful}" + depend() { need net use mysql dns logger netmount postgresql @@ -28,17 +35,11 @@ configtest() { } checkconfd() { - PIDFILE="${PIDFILE:-/var/run/apache2.pid}" - TIMEOUT=${TIMEOUT:-15} - - SERVERROOT="${SERVERROOT:-/usr/lib/apache2}" if [ ! -d ${SERVERROOT} ]; then eerror "SERVERROOT does not exist: ${SERVERROOT}" return 1 fi - CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" - APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" [ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}" @@ -106,8 +107,6 @@ stop() { } reload() { - RELOAD_TYPE="${RELOAD_TYPE:-graceful}" - checkconfig || return 1 if [ "${RELOAD_TYPE}" = "restart" ]; then -- cgit v1.2.3-65-gdbad