3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
19 # Startup script for the Apache Web Server
22 # description: Apache is a World Wide Web server. It is used to serve \
25 # pidfile: /var/run/httpd.pid
26 # config: /etc/httpd/conf/httpd.conf
28 # Source function library.
29 . /etc/rc.d/init.d/functions
31 if [ -f /etc/sysconfig/httpd ]; then
32 . /etc/sysconfig/httpd
35 # This will prevent initlog from swallowing up a pass-phrase prompt if
36 # mod_ssl needs a pass-phrase from the user.
39 # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
40 # with the thread-based "worker" MPM; BE WARNED that some modules may not
41 # work correctly with a thread-based MPM; notably PHP will refuse to start.
43 # Path to the apachectl script, server binary, and short-form for messages.
44 apachectl=/usr/sbin/apachectl
45 httpd=${HTTPD-/usr/sbin/httpd}
49 # check for 1.3 configuration
51 CONFFILE=/etc/httpd/conf/httpd.conf
52 GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
53 GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
54 GONE="${GONE}AccessConfig|ResourceConfig)"
55 if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
57 echo 1>&2 " Apache 1.3 configuration directives found"
58 echo 1>&2 " please read @docdir@/migration.html"
59 failure "Apache 1.3 config directives test"
65 # The semantics of these two functions differ from the way apachectl does
66 # things -- attempting to start while running is a failure, and shutdown
67 # when not running is also a failure. So we just do it the way init scripts
68 # are expected to behave here.
70 echo -n $"Starting $prog: "
72 daemon $httpd $OPTIONS
75 [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
79 echo -n $"Stopping $prog: "
83 [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
86 echo -n $"Reloading $prog: "
93 # See how we were called.
110 if [ -f /var/run/httpd.pid ] ; then
118 graceful|help|configtest|fullstatus)
123 echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"