diff options
author | Michael Stewart <vericgar@gentoo.org> | 2006-10-15 22:01:47 +0000 |
---|---|---|
committer | Michael Stewart <vericgar@gentoo.org> | 2006-10-15 22:01:47 +0000 |
commit | 75c15a78bba18761fba8252e478b8fb9a9fada42 (patch) | |
tree | 929fa492d1c998130e1b04dbea300d15652fdeb5 /2.0 | |
parent | Don't include --with-suexec-bin in the ./configure options as it's hardcoded ... (diff) | |
download | apache-75c15a78bba18761fba8252e478b8fb9a9fada42.tar.gz apache-75c15a78bba18761fba8252e478b8fb9a9fada42.tar.bz2 apache-75c15a78bba18761fba8252e478b8fb9a9fada42.zip |
Updated init script to use start-stop-daemon so that apache stops correctly instead of just exiting after the signal is sent
Diffstat (limited to '2.0')
-rwxr-xr-x | 2.0/init/apache2.initd | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/2.0/init/apache2.initd b/2.0/init/apache2.initd index 6e36156..9eb9e40 100755 --- a/2.0/init/apache2.initd +++ b/2.0/init/apache2.initd @@ -35,15 +35,9 @@ checkconfig() { return 1 fi - # check to see if the old config files exist and aren't used - if [[ "${CONFIGFILE}" != "/etc/apache2/conf/apache2.conf" && - -e "/etc/apache2/conf/apache2.conf" ]]; then - eerror "Found old apache2.conf in /etc/apache2/conf. Configuration locations \n have moved, please check ${CONFIGFILE} to make sure it is correct, \n and remove /etc/apache2/conf/apache2.conf.\n\n Please see http://www.gentoo.org/doc/en/apache-upgrading.xml\n for more information." - return 1 - fi - - [ -n "${SERVERROOT}" ] && APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" - [ -n "${CONFIGFILE}" ] && APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" + + APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" + APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" [ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}" # set a sane default for KEEPENV and OLDENV @@ -51,12 +45,13 @@ checkconfig() { OLDENV= for env_var in ${KEEPENV}; do - OLDENV="${OLDENV} ${env_var}=`printenv ${env_var}`" + OLDENV="${OLDENV} ${env_var}=\"`printenv ${env_var}`\"" + SDDENV="${SSDENV} --env ${env_var}=\"`printenv ${env_var}`\"" done - APACHE2="env -i ${OLDENV} /usr/sbin/apache2" + APACHE2="/usr/sbin/apache2" - $APACHE2 ${APACHE2_OPTS} -t 1>/dev/null 2>&1 + env -i ${OLDENV} ${APACHE2} ${APACHE2_OPTS} -t 1>/dev/null 2>&1 ret=$? if [ $ret -ne 0 ]; then eerror "Apache2 has detected a syntax error in your configuration files:" @@ -70,24 +65,20 @@ start() { checkconfig || return 1 ebegin "Starting apache2" [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache - ${APACHE2} ${APACHE2_OPTS} -k start + env -i /sbin/start-stop-daemon --start --exec ${APACHE2} --pidfile /var/run/apache2.pid ${SSDENV} -- ${APACHE2_OPTS} -k start eend $? } stop() { checkconfig || return 1 ebegin "Stopping apache2" - ${APACHE2} ${APACHE2_OPTS} -k stop + /sbin/start-stop-daemon --stop --retry -TERM/5/-TERM/5/-KILL/5 --exec ${APACHE2} --pidfile /var/run/apache2.pid eend $? } reload() { - if ! service_started "${myservice}" ; then - eerror "Apache is not running! Please start it before trying to reload it." - else - checkconfig || return 1 - ebegin "Reloading apache2" - ${APACHE2} ${APACHE2_OPTS} -k graceful - eend $? - fi + checkconfig || return 1 + ebegin "Doing a graceful restart of apache2" + /sbin/start-stop-daemon --stop --signal USR1 --exec ${APACHE2} --pidfile /var/run/apache2.pid + eend $? } |