upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / build / rpm / httpd.init
1 #!/bin/bash
2 #
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
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 #
19 # Startup script for the Apache Web Server
20 #
21 # chkconfig: - 85 15
22 # description: Apache is a World Wide Web server.  It is used to serve \
23 #              HTML files and CGI.
24 # processname: httpd
25 # pidfile: /var/run/httpd.pid
26 # config: /etc/httpd/conf/httpd.conf
27
28 # Source function library.
29 . /etc/rc.d/init.d/functions
30
31 if [ -f /etc/sysconfig/httpd ]; then
32         . /etc/sysconfig/httpd
33 fi
34
35 # This will prevent initlog from swallowing up a pass-phrase prompt if
36 # mod_ssl needs a pass-phrase from the user.
37 INITLOG_ARGS=""
38
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.
42
43 # Path to the apachectl script, server binary, and short-form for messages.
44 apachectl=/usr/sbin/apachectl
45 httpd=${HTTPD-/usr/sbin/httpd}
46 prog=httpd
47 RETVAL=0
48
49 # check for 1.3 configuration
50 check13 () {
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
56                 echo
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"
60                 echo
61                 exit 1
62         fi
63 }
64
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.
69 start() {
70         echo -n $"Starting $prog: "
71         check13 || exit 1
72         daemon $httpd $OPTIONS
73         RETVAL=$?
74         echo
75         [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
76         return $RETVAL
77 }
78 stop() {
79         echo -n $"Stopping $prog: "
80         killproc $httpd
81         RETVAL=$?
82         echo
83         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
84 }
85 reload() {
86         echo -n $"Reloading $prog: "
87         check13 || exit 1
88         killproc $httpd -HUP
89         RETVAL=$?
90         echo
91 }
92
93 # See how we were called.
94 case "$1" in
95   start)
96         start
97         ;;
98   stop)
99         stop
100         ;;
101   status)
102         status $httpd
103         RETVAL=$?
104         ;;
105   restart)
106         stop
107         start
108         ;;
109   condrestart)
110         if [ -f /var/run/httpd.pid ] ; then
111                 stop
112                 start
113         fi
114         ;;
115   reload)
116         reload
117         ;;
118   graceful|help|configtest|fullstatus)
119         $apachectl $@
120         RETVAL=$?
121         ;;
122   *)
123         echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
124         exit 1
125 esac
126
127 exit $RETVAL