[Pkg-apache-commits] r1140 - in /trunk/apache2: apache2.2-common.apache2.init apache2.2-common.install apache2ctl changelog patches/002_apachectl patches/00list patches/050_enhance_apache2ctl.dpatch rules
sf at alioth.debian.org
sf at alioth.debian.org
Sun Feb 7 00:37:45 UTC 2010
Author: sf
Date: Sun Feb 7 00:37:44 2010
New Revision: 1140
URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1140
Log:
Add support for multiple apache2 instances to initscript and apache2ctl.
Added:
trunk/apache2/apache2ctl (with props)
Removed:
trunk/apache2/patches/002_apachectl
trunk/apache2/patches/050_enhance_apache2ctl.dpatch
Modified:
trunk/apache2/apache2.2-common.apache2.init
trunk/apache2/apache2.2-common.install
trunk/apache2/changelog
trunk/apache2/patches/00list
trunk/apache2/rules
Modified: trunk/apache2/apache2.2-common.apache2.init
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/apache2.2-common.apache2.init?rev=1140&op=diff
==============================================================================
--- trunk/apache2/apache2.2-common.apache2.init (original)
+++ trunk/apache2/apache2.2-common.apache2.init Sun Feb 7 00:37:44 2010
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/sh
### BEGIN INIT INFO
# Provides: apache2
# Required-Start: $local_fs $remote_fs $network $syslog
@@ -8,28 +8,44 @@
# X-Interactive: true
# Short-Description: Start/stop apache2 web server
### END INIT INFO
-#
-# apache2 This init.d script is used to start apache2.
-# It basically just calls apache2ctl.
+
+set -e
+
+if [ -n "$APACHE_CONFDIR" ] ; then
+ DIR_SUFFIX=
+elif [ "${0##*/apache2-}" != "$0" ] ; then
+ DIR_SUFFIX="-${0##*/apache2-}"
+ APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX
+else
+ DIR_SUFFIX=
+ APACHE_CONFDIR=/etc/apache2
+fi
+if [ -z "$APACHE_ENVVARS" ] ; then
+ APACHE_ENVVARS=$APACHE_CONFDIR/envvars
+fi
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
-
-#[ $(ls -1 /etc/apache2/sites-enabled/ | wc -l | sed -e 's/ *//;') -eq 0 ] && \
-#echo "You haven't enabled any sites yet, so I'm not starting apache2." && \
-#echo "To add and enable a host, use addhost and enhost." && exit 0
+if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then
+ ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
+fi
+if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then
+ ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
+fi
+
#edit /etc/default/apache2 to change this.
HTCACHECLEAN_RUN=auto
HTCACHECLEAN_MODE=daemon
HTCACHECLEAN_SIZE=300M
HTCACHECLEAN_DAEMON_INTERVAL=120
-HTCACHECLEAN_PATH=/var/cache/apache2/mod_disk_cache
+HTCACHECLEAN_PATH=/var/cache/apache2$DIR_SUFFIX/mod_disk_cache
HTCACHECLEAN_OPTIONS=""
-set -e
-if [ -x /usr/sbin/apache2 ] ; then
- HAVE_APACHE2=1
-else
+APACHE_HTTPD=$(. $APACHE_ENVVARS && echo $APACHE_HTTPD)
+if [ -z "$APACHE_HTTPD" ] ; then
+ APACHE_HTTPD=/usr/sbin/apache2
+fi
+if [ ! -x $APACHE_HTTPD ] ; then
echo "No apache MPM package installed"
exit 0
fi
@@ -37,14 +53,19 @@
. /lib/lsb/init-functions
test -f /etc/default/rcS && . /etc/default/rcS
-test -f /etc/default/apache2 && . /etc/default/apache2
+
+if [ -f /etc/default/apache2$DIR_SUFFIX ] ; then
+ . /etc/default/apache2$DIR_SUFFIX
+elif [ -f /etc/default/apache2 ] ; then
+ . /etc/default/apache2
+fi
APACHE2CTL="$ENV /usr/sbin/apache2ctl"
HTCACHECLEAN="$ENV /usr/sbin/htcacheclean"
-PIDFILE=$(. /etc/apache2/envvars && echo $APACHE_PID_FILE)
+PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)
if [ -z "$PIDFILE" ] ; then
- echo ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars >&2
+ echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2
exit 2
fi
@@ -54,16 +75,20 @@
[ "$HTCACHECLEAN_RUN" = "yes" ] && return 0
+ MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED)
[ "$HTCACHECLEAN_RUN" = "auto" \
- -a -e /etc/apache2/mods-enabled/disk_cache.load ] && return 0
+ -a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/disk_cache.load ] && \
+ return 0
return 1
}
start_htcacheclean() {
+ if [ ! -d "$HTCACHECLEAN_PATH" ] ; then
+ echo "Directory $HTCACHECLEAN_PATH does not exist!" >&2
+ fi
$HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \
-i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE
-
}
stop_htcacheclean() {
@@ -74,7 +99,7 @@
# if there is actually an apache2 process whose pid is in PIDFILE,
# print it and return 0.
if [ -e "$PIDFILE" ]; then
- if pidof apache2 | tr ' ' '\n' | grep $(cat $PIDFILE); then
+ if pidof apache2 | tr ' ' '\n' | grep -w $(cat $PIDFILE); then
return 0
fi
fi
@@ -91,9 +116,9 @@
PID=$(pidof_apache) || true
if [ "${PID}" ]; then
- # in this case it is everything nice and dandy
- # and we kill apache2
- log_warning_msg "We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
+ # in this case it is everything nice and dandy and we kill apache2
+ echo
+ log_warning_msg "The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
kill $PID
elif [ "$(pidof apache2)" ]; then
if [ "$VERBOSE" != no ]; then
@@ -226,15 +251,15 @@
status)
PID=$(pidof_apache) || true
if [ -n "$PID" ]; then
- echo "Apache is running (pid $PID)."
+ echo "Apache2 is running (pid $PID)."
exit 0
else
- echo "Apache is NOT running."
+ echo "Apache2$DIR_SUFFIX is NOT running."
exit 1
fi
;;
*)
- log_success_msg "Usage: /etc/init.d/apache2 {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}"
+ log_success_msg "Usage: /etc/init.d/apache2$DIR_SUFFIX {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}"
exit 1
;;
esac
Modified: trunk/apache2/apache2.2-common.install
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/apache2.2-common.install?rev=1140&op=diff
==============================================================================
--- trunk/apache2/apache2.2-common.install (original)
+++ trunk/apache2/apache2.2-common.install Sun Feb 7 00:37:44 2010
@@ -1,7 +1,7 @@
usr/share/apache2/icons
-usr/sbin/apache2ctl
usr/share/apache2/error
usr/sbin/envvars-std usr/share/apache2/build
etc/apache2 usr/share/doc/apache2.2-common/examples
debian/config-dir/* etc/apache2
debian/a2enmod usr/sbin
+debian/apache2ctl usr/sbin
Added: trunk/apache2/apache2ctl
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/apache2ctl?rev=1140&op=file
==============================================================================
--- trunk/apache2/apache2ctl (added)
+++ trunk/apache2/apache2ctl Sun Feb 7 00:37:44 2010
@@ -1,0 +1,151 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# Apache control script designed to allow an easy command line interface
+# to controlling Apache. Written by Marc Slemko, 1997/08/23
+#
+# Heavily modified for Debian by Stefan Fritsch 2007-2010
+#
+# The exit codes returned are:
+# XXX this doc is no longer correct now that the interesting
+# XXX functions are handled by httpd
+# 0 - operation completed successfully
+# 1 -
+# 2 - usage error
+# 3 - httpd could not be started
+# 4 - httpd could not be stopped
+# 5 - httpd could not be started during a restart
+# 6 - httpd could not be restarted during a restart
+# 7 - httpd could not be restarted during a graceful restart
+# 8 - configuration syntax error
+#
+# When multiple arguments are given, only the error from the _last_
+# one is reported. Run "apachectl help" for usage info
+#
+ARGV="$@"
+#
+# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
+# -------------------- --------------------
+#
+# main configuration directory
+if test -z "$APACHE_CONFDIR" ; then
+ if test "${0##*apache2-}" != "$0" ; then
+ APACHE_CONFDIR="/etc/apache2-${0##*apache2-}"
+ else
+ APACHE_CONFDIR=/etc/apache2
+ fi
+fi
+# the path to the environment variable file
+test -z "$APACHE_ENVVARS" && APACHE_ENVVARS="$APACHE_CONFDIR/envvars"
+# pick up any necessary environment variables
+if test -f $APACHE_ENVVARS; then
+ . $APACHE_ENVVARS
+fi
+
+if test "$APACHE_CONFDIR" != /etc/apache2 ; then
+ APACHE_ARGUMENTS="-d $APACHE_CONFDIR $APACHE_ARGUMENTS"
+fi
+# the following APACHE_* variables should be set in /etc/apache2/envvars
+#
+# the path to your httpd binary, including options if necessary
+HTTPD=${APACHE_HTTPD:-/usr/sbin/apache2}
+#
+# a command that outputs a formatted text version of the HTML at the
+# url given on the command line. Designed for lynx, however other
+# programs may work.
+LYNX="${APACHE_LYNX:-www-browser -dump}"
+#
+# the URL to your server's mod_status status page. If you do not
+# have one, then status and fullstatus will not work.
+STATUSURL="${APACHE_STATUSURL:-http://localhost:80/server-status}"
+#
+# Set this variable to a command that increases the maximum
+# number of file descriptors allowed per child process. This is
+# critical for configurations that use many file descriptors,
+# such as mass vhosting, or a multithreaded server.
+ULIMIT_MAX_FILES="${APACHE_ULIMIT_MAX_FILES:-ulimit -S -n `ulimit -H -n`}"
+# -------------------- --------------------
+# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
+
+# Set the maximum number of file descriptors allowed per child process.
+if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
+ $ULIMIT_MAX_FILES
+fi
+
+ERROR=0
+if [ "x$ARGV" = "x" ] || [ "x$ARGV" = "xusage" ] || [ "x$ARGV" = "xhelp" ] || [ "x$ARGV" = "x--help" ]; then
+ echo "Usage: $0 start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus|help" >&2
+ echo " $0 <apache2 args>" >&2
+ echo " $0 -h (for help on <apache2 args>)" >&2
+ exit 1
+fi
+
+get_status () {
+ if ! $LYNX $STATUSURL ; then
+ echo "'$LYNX $STATUSURL'" failed. >&2
+ echo Maybe you need to install a package providing www-browser or you >&2
+ echo need to adjust the APACHE_LYNX variable in /etc/apache2/envvars >&2
+ exit 1
+ fi
+}
+
+case $ARGV in
+start)
+ mkdir -p ${APACHE_RUN_DIR:-/var/run/apache2}
+ install -d -o ${APACHE_RUN_USER:-www-data} ${APACHE_LOCK_DIR:-/var/lock/apache2}
+ # ssl_scache shouldn't be here if we're just starting up.
+ # (this is bad if there are several apache2 instances running)
+ rm -f ${APACHE_RUN_DIR:-/var/run/apache2}/*ssl_scache*
+ $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
+ ERROR=$?
+ ;;
+stop|graceful-stop)
+ $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
+ ERROR=$?
+ ;;
+restart|graceful)
+ if $HTTPD ${APACHE_ARGUMENTS} -t 2> /dev/null ; then
+ $HTTPD ${APACHE_ARGUMENTS} -k $ARGV
+ else
+ $HTTPD ${APACHE_ARGUMENTS} -t
+ fi
+ ERROR=$?
+ ;;
+startssl|sslstart|start-SSL)
+ echo The startssl option is no longer supported.
+ echo Please edit httpd.conf to include the SSL configuration settings
+ echo and then use "apachectl start".
+ ERROR=2
+ ;;
+configtest)
+ $HTTPD ${APACHE_ARGUMENTS} -t
+ ERROR=$?
+ ;;
+status)
+ get_status | awk ' /process$/ { print; exit } { print } '
+ ;;
+fullstatus)
+ get_status
+ ;;
+*)
+ $HTTPD ${APACHE_ARGUMENTS} $ARGV
+ ERROR=$?
+esac
+
+exit $ERROR
+
Propchange: trunk/apache2/apache2ctl
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1140&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Sun Feb 7 00:37:44 2010
@@ -1,6 +1,8 @@
apache2 (2.2.14-6) UNRELEASED; urgency=low
* Move ab and logresolve from /usr/sbin to /usr/bin. Closes: #351450, #564061
+ * Add support for multiple apache2 instances to initscript and apache2ctl.
+ Documentation ist still missing, though... Closes: #353450
* Set default compiled-in ServerRoot to /etc/apache2 and make paths in
apache2.conf relative to ServerRoot.
* Fix symlinks in apache2-dbg package. Closes: #567076
Modified: trunk/apache2/patches/00list
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/00list?rev=1140&op=diff
==============================================================================
--- trunk/apache2/patches/00list (original)
+++ trunk/apache2/patches/00list Sun Feb 7 00:37:44 2010
@@ -1,5 +1,4 @@
001_branding
-002_apachectl
004_usr_bin_perl_0wnz_j00
008_make_include_safe
009_apache2_has_dso
@@ -12,7 +11,6 @@
042_htdigest_CAN-2005-1344
045_suexec_log_cloexec.dpatch
047_fix_usage_message.dpatch
-050_enhance_apache2ctl.dpatch
052_logresolve_linelength.dpatch
057_disablemods.dpatch
058_suexec-CVE-2007-1742.dpatch
Modified: trunk/apache2/rules
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/rules?rev=1140&op=diff
==============================================================================
--- trunk/apache2/rules (original)
+++ trunk/apache2/rules Sun Feb 7 00:37:44 2010
@@ -208,14 +208,13 @@
rm -rf debian/tmp/usr/include
rm -rf debian/tmp/usr/share/apache2/build
rm -f debian/tmp/usr/share/man/man8/httpd.8 # We install our own
- rm -f debian/tmp/usr/sbin/apxs debian/tmp/usr/sbin/apache2
+ rm -f debian/tmp/usr/sbin/apxs debian/tmp/usr/sbin/apache2 debian/tmp/usr/sbin/apachectl
# DO NOT FALL FOR THE TEMPTATION TO MV INTO PACKAGES OR DOOM
# WILL FIND YOU. Use dh_install, this is just because dh_install
# can't rename files
mv debian/tmp/usr/share/man/man8/apxs.8 debian/tmp/usr/share/man/man8/apxs2.8
- mv debian/tmp/usr/sbin/apachectl debian/tmp/usr/sbin/apache2ctl
mv debian/tmp/usr/share/man/man8/apachectl.8 debian/tmp/usr/share/man/man8/apache2ctl.8
mkdir -p debian/tmp/usr/share/apache2/icons/
for i in `ls debian/icons/ | cut -d. -f1,2`; do \
More information about the Pkg-apache-commits
mailing list