summaryrefslogtreecommitdiff
path: root/2.4/init
diff options
context:
space:
mode:
Diffstat (limited to '2.4/init')
-rw-r--r--2.4/init/apache2.confd74
-rwxr-xr-x2.4/init/apache2.initd183
2 files changed, 257 insertions, 0 deletions
diff --git a/2.4/init/apache2.confd b/2.4/init/apache2.confd
new file mode 100644
index 0000000..c520c20
--- /dev/null
+++ b/2.4/init/apache2.confd
@@ -0,0 +1,74 @@
+# /etc/conf.d/apache2: config file for /etc/init.d/apache2
+
+# When you install a module it is easy to activate or deactivate the modules
+# and other features of apache using the APACHE2_OPTS line. Every module should
+# install a configuration in /etc/apache2/modules.d. In that file will have an
+# <IfDefine NNN> directive where NNN is the option to enable that module.
+#
+# Here are the options available in the default configuration:
+#
+# AUTH_DIGEST Enables mod_auth_digest
+# AUTHNZ_LDAP Enables authentication through mod_ldap (available if USE=ldap)
+# CACHE Enables mod_cache
+# DAV Enables mod_dav
+# ERRORDOCS Enables default error documents for many languages.
+# INFO Enables mod_info, a useful module for debugging
+# LANGUAGE Enables content-negotiation based on language and charset.
+# LDAP Enables mod_ldap (available if USE=ldap)
+# MANUAL Enables /manual/ to be the apache manual (available if USE=docs)
+# MEM_CACHE Enables default configuration mod_mem_cache
+# PROXY Enables mod_proxy
+# SSL Enables SSL (available if USE=ssl)
+# STATUS Enabled mod_status, a useful module for statistics
+# SUEXEC Enables running CGI scripts (in USERDIR) through suexec.
+# USERDIR Enables /~username mapping to /home/username/public_html
+#
+#
+# The following two options provide the default virtual host for the HTTP and
+# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
+# will not listen for incomming connections on the approriate port.
+#
+# DEFAULT_VHOST Enables name-based virtual hosts, with the default
+# virtual host being in /var/www/localhost/htdocs
+# SSL_DEFAULT_VHOST Enables default vhost for SSL (you should enable this
+# when you enable SSL)
+#
+APACHE2_OPTS="-D DEFAULT_VHOST -D LANGUAGE -D INFO"
+
+# Extended options for advanced uses of Apache ONLY
+# You don't need to edit these unless you are doing crazy Apache stuff
+# As not having them set correctly, or feeding in an incorrect configuration
+# via them will result in Apache failing to start
+# YOU HAVE BEEN WARNED.
+
+# PID file
+#PIDFILE=/run/apache2.pid
+
+# timeout for startup/shutdown checks
+#TIMEOUT=10
+
+# ServerRoot setting
+#SERVERROOT=/usr/lib/apache2
+
+# Configuration file location
+# - If this does NOT start with a '/', then it is treated relative to
+# $SERVERROOT by Apache
+#CONFIGFILE=/etc/apache2/httpd.conf
+
+# Location to log startup errors to
+# They are normally dumped to your terminal.
+#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
+
+# A command that outputs a formatted text version of the HTML at the URL
+# of the command line. Designed for lynx, however other programs may work.
+#LYNX="lynx -dump"
+
+# The URL to your server's mod_status status page.
+# Required for status and fullstatus
+#STATUSURL="http://localhost/server-status"
+
+# Method to use when reloading the server
+# Valid options are 'restart' and 'graceful'
+# See http://httpd.apache.org/docs/2.2/stopping.html for information on
+# what they do and how they differ.
+#RELOAD_TYPE="graceful"
diff --git a/2.4/init/apache2.initd b/2.4/init/apache2.initd
new file mode 100755
index 0000000..a95e41a
--- /dev/null
+++ b/2.4/init/apache2.initd
@@ -0,0 +1,183 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="configtest modules virtualhosts"
+extra_started_commands="configdump fullstatus graceful gracefulstop reload"
+
+description_configdump="Dumps the configuration of the runing apache server. Requires server-info to be enabled and www-client/lynx."
+description_configtest="Run syntax tests for configuration files."
+description_fullstatus="Gives the full status of the server. Requires lynx and server-status to be enabled."
+description_graceful="A graceful restart advises the children to exit after the current request and reloads the configuration."
+description_gracefulstop="A graceful stop advises the children to exit after the current request and stops the server."
+description_modules="Dump a list of loaded Static and Shared Modules."
+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."
+
+depend() {
+ need net
+ use mysql dns logger netmount postgresql
+ after sshd
+}
+
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+checkconfd() {
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "This init script works only with openrc (baselayout-2)."
+ eerror "If you still need baselayout-1.x, please, use"
+ eerror "apache2.initd-baselayout-1 from /usr/share/doc/apache2-*/"
+ fi
+
+ PIDFILE="${PIDFILE:-/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}"
+ [ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
+ if [ ! -r "${CONFIGFILE}" ]; then
+ eerror "Unable to read configuration file: ${CONFIGFILE}"
+ return 1
+ fi
+
+ APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}"
+ APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"
+ [ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}"
+
+ APACHE2="/usr/sbin/apache2"
+}
+
+checkconfig() {
+ checkpath --directory /run/apache_ssl_mutex
+ checkconfd || return 1
+
+ ${APACHE2} ${APACHE2_OPTS} -t 1>/dev/null 2>&1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected an error in your setup:"
+ ${APACHE2} ${APACHE2_OPTS} -t
+ fi
+
+ return $ret
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting ${SVCNAME}"
+ # Use start stop daemon to apply system limits #347301
+ start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start
+
+ i=0
+ while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do
+ sleep 1 && i=$(expr $i + 1)
+ done
+
+ eend $(test $i -lt ${TIMEOUT})
+}
+
+stop() {
+ if [ "${RC_CMD}" = "restart" ]; then
+ checkconfig || return 1
+ else
+ checkconfd || return 1
+ fi
+
+ PID=$(cat "${PIDFILE}" 2>/dev/null)
+ if [ -z "${PID}" ]; then
+ einfo "${SVCNAME} not running (no pid file)"
+ return 0
+ fi
+
+ ebegin "Stopping ${SVCNAME}"
+ ${APACHE2} ${APACHE2_OPTS} -k stop
+
+ i=0
+ while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \
+ && [ $i -lt ${TIMEOUT} ]; do
+ sleep 1 && i=$(expr $i + 1)
+ done
+
+ eend $(test $i -lt ${TIMEOUT})
+}
+
+reload() {
+ RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
+
+ checkconfig || return 1
+
+ if [ "${RELOAD_TYPE}" = "restart" ]; then
+ ebegin "Restarting ${SVCNAME}"
+ ${APACHE2} ${APACHE2_OPTS} -k restart
+ eend $?
+ elif [ "${RELOAD_TYPE}" = "graceful" ]; then
+ ebegin "Gracefully restarting ${SVCNAME}"
+ ${APACHE2} ${APACHE2_OPTS} -k graceful
+ eend $?
+ else
+ eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}"
+ fi
+}
+
+graceful() {
+ checkconfig || return 1
+ ebegin "Gracefully restarting ${SVCNAME}"
+ ${APACHE2} ${APACHE2_OPTS} -k graceful
+ eend $?
+}
+
+gracefulstop() {
+ checkconfig || return 1
+ ebegin "Gracefully stopping ${SVCNAME}"
+ ${APACHE2} ${APACHE2_OPTS} -k graceful-stop
+ eend $?
+}
+
+modules() {
+ checkconfig || return 1
+ ${APACHE2} ${APACHE2_OPTS} -M 2>&1
+}
+
+fullstatus() {
+ LYNX="${LYNX:-lynx -dump}"
+ STATUSURL="${STATUSURL:-http://localhost/server-status}"
+
+ if ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
+ eerror "lynx not found! you need to emerge www-client/lynx"
+ else
+ ${LYNX} ${STATUSURL}
+ fi
+}
+
+virtualhosts() {
+ checkconfig || return 1
+ ${APACHE2} ${APACHE2_OPTS} -S
+}
+
+configdump() {
+ LYNX="${LYNX:-lynx -dump}"
+ INFOURL="${INFOURL:-http://localhost/server-info}"
+
+ checkconfd || return 1
+
+ if ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
+ eerror "lynx not found! you need to emerge www-client/lynx"
+ else
+ echo "${APACHE2} started with '${APACHE2_OPTS}'"
+ for i in config server list; do
+ ${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
+ done
+ fi
+}
+
+# vim: ts=4 filetype=gentoo-init-d