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 # httpd Startup script for the Apache Web Server
22 # description: The Apache HTTP Server is an efficient and extensible \
23 # server implementing the current HTTP standards.
25 # pidfile: /var/log/httpd/httpd.pid
26 # config: /etc/sysconfig/httpd
30 # Required-Start: $local_fs $remote_fs $network $named
31 # Required-Stop: $local_fs $remote_fs $network
32 # Should-Start: distcache
33 # Short-Description: start and stop Apache HTTP Server
34 # Description: The Apache HTTP Server is an extensible server
35 # implementing the current HTTP standards.
38 # Source function library.
39 . /etc/rc.d/init.d/functions
41 if [ -f /etc/sysconfig/httpd ]; then
42 . /etc/sysconfig/httpd
45 # Start httpd in the C locale by default.
46 HTTPD_LANG=${HTTPD_LANG-"C"}
48 # This will prevent initlog from swallowing up a pass-phrase prompt if
49 # mod_ssl needs a pass-phrase from the user.
52 # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
53 # with the thread-based "worker" MPM; BE WARNED that some modules may not
54 # work correctly with a thread-based MPM; notably PHP will refuse to start.
56 httpd=${HTTPD-/usr/sbin/httpd}
58 pidfile=${PIDFILE-/var/log/httpd/httpd.pid}
59 lockfile=${LOCKFILE-/var/lock/subsys/httpd}
62 # check for 1.3 configuration
64 CONFFILE=/etc/httpd/conf/httpd.conf
65 GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
66 GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
67 GONE="${GONE}AccessConfig|ResourceConfig)"
68 if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
70 echo 1>&2 " Apache 1.3 configuration directives found"
71 echo 1>&2 " please read @docdir@/migration.html"
72 failure "Apache 1.3 config directives test"
78 # The semantics of these two functions differ from the way apachectl does
79 # things -- attempting to start while running is a failure, and shutdown
80 # when not running is also a failure. So we just do it the way init scripts
81 # are expected to behave here.
83 echo -n $"Starting $prog: "
85 LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
88 [ $RETVAL = 0 ] && touch ${lockfile}
92 echo -n $"Stopping $prog: "
93 killproc -p ${pidfile} -d 10 $httpd
96 [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
99 echo -n $"Reloading $prog: "
101 killproc -p ${pidfile} $httpd -HUP
106 # See how we were called.
115 if ! test -f ${pidfile}; then
116 echo $prog is stopped
119 status -p ${pidfile} $httpd
128 if test -f ${pidfile} && status -p ${pidfile} $httpd >&/dev/null; then
137 LANG=$HTTPD_LANG $httpd $OPTIONS -t
141 echo -n $"Gracefully restarting $prog: "
142 LANG=$HTTPD_LANG $httpd $OPTIONS -k $@
147 echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|graceful|help|configtest}"