3 # Copyright (c) 2000-2001 The Apache Software Foundation.
4 # See license at the end of this file.
6 # Apache control script designed to allow an easy command line interface
7 # to controlling Apache. Written by Marc Slemko, 1997/08/23
9 # The exit codes returned are:
10 # 0 - operation completed successfully
13 # 3 - httpd could not be started
14 # 4 - httpd could not be stopped
15 # 5 - httpd could not be started during a restart
16 # 6 - httpd could not be restarted during a restart
17 # 7 - httpd could not be restarted during a graceful restart
18 # 8 - configuration syntax error
20 # When multiple arguments are given, only the error from the _last_
21 # one is reported. Run "apachectl help" for usage info
24 # |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
25 # -------------------- --------------------
27 # the path to your PID file
28 PIDFILE=@prefix@/logs/@progname@.pid
30 # the path to your httpd binary, including options if necessary
31 HTTPD='@prefix@/bin/@progname@'
33 # a command that outputs a formatted text version of the HTML at the
34 # url given on the command line. Designed for lynx, however other
38 # the URL to your server's mod_status status page. If you do not
39 # have one, then status and fullstatus will not work.
40 STATUSURL="http://localhost:@PORT@/server-status"
42 # -------------------- --------------------
43 # |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
47 if [ "x$ARGV" = "x" ] ; then
54 if [ -f $PIDFILE ] ; then
56 if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
57 STATUS="@progname@ (pid $PID) running"
60 STATUS="@progname@ (pid $PID?) not running"
64 STATUS="@progname@ (no pid file) not running"
70 if [ $RUNNING -eq 1 ]; then
71 echo "$0 $ARG: @progname@ (pid $PID) already running"
75 echo "$0 $ARG: @progname@ started"
77 echo "$0 $ARG: @progname@ could not be started"
81 startssl|sslstart|start-SSL)
82 if [ $RUNNING -eq 1 ]; then
83 echo "$0 $ARG: @progname@ (pid $PID) already running"
87 echo "$0 $ARG: @progname@ started"
89 echo "$0 $ARG: @progname@ could not be started"
94 if [ $RUNNING -eq 0 ]; then
95 echo "$0 $ARG: $STATUS"
99 echo "$0 $ARG: @progname@ stopped"
101 echo "$0 $ARG: @progname@ could not be stopped"
106 if [ $RUNNING -eq 0 ]; then
107 echo "$0 $ARG: @progname@ not running, trying to start"
109 echo "$0 $ARG: @progname@ started"
111 echo "$0 $ARG: @progname@ could not be started"
115 if $HTTPD -t >/dev/null 2>&1; then
116 if kill -HUP $PID ; then
117 echo "$0 $ARG: @progname@ restarted"
119 echo "$0 $ARG: @progname@ could not be restarted"
123 echo "$0 $ARG: configuration broken, ignoring restart"
124 echo "$0 $ARG: (run 'apachectl configtest' for details)"
130 if [ $RUNNING -eq 0 ]; then
131 echo "$0 $ARG: @progname@ not running, trying to start"
133 echo "$0 $ARG: @progname@ started"
135 echo "$0 $ARG: @progname@ could not be started"
139 if $HTTPD -t >/dev/null 2>&1; then
140 if kill -@AP_SIG_GRACEFUL_SHORT@ $PID ; then
141 echo "$0 $ARG: @progname@ gracefully restarted"
143 echo "$0 $ARG: @progname@ could not be restarted"
147 echo "$0 $ARG: configuration broken, ignoring restart"
148 echo "$0 $ARG: (run 'apachectl configtest' for details)"
154 $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
167 echo "usage: $0 (start|stop|restart|fullstatus|status|graceful|configtest|help)"
170 start - start @progname@
171 startssl - start @progname@ with SSL enabled
172 stop - stop @progname@
173 restart - restart @progname@ if running by sending a SIGHUP or start if
175 fullstatus - dump a full status screen; requires lynx and mod_status enabled
176 status - dump a short status screen; requires lynx and mod_status enabled
177 graceful - do a graceful restart by sending a @AP_SIG_GRACEFUL@ or start if not running
178 configtest - do a configuration syntax test
191 # ====================================================================
192 # The Apache Software License, Version 1.1
194 # Copyright (c) 2000-2001 The Apache Software Foundation. All rights
197 # Redistribution and use in source and binary forms, with or without
198 # modification, are permitted provided that the following conditions
201 # 1. Redistributions of source code must retain the above copyright
202 # notice, this list of conditions and the following disclaimer.
204 # 2. Redistributions in binary form must reproduce the above copyright
205 # notice, this list of conditions and the following disclaimer in
206 # the documentation and/or other materials provided with the
209 # 3. The end-user documentation included with the redistribution,
210 # if any, must include the following acknowledgment:
211 # "This product includes software developed by the
212 # Apache Software Foundation (http://www.apache.org/)."
213 # Alternately, this acknowledgment may appear in the software itself,
214 # if and wherever such third-party acknowledgments normally appear.
216 # 4. The names "Apache" and "Apache Software Foundation" must
217 # not be used to endorse or promote products derived from this
218 # software without prior written permission. For written
219 # permission, please contact apache@apache.org.
221 # 5. Products derived from this software may not be called "Apache",
222 # nor may "Apache" appear in their name, without prior written
223 # permission of the Apache Software Foundation.
225 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
226 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
227 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
228 # DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
229 # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
230 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
231 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
232 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
233 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
234 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
235 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
237 # ====================================================================
239 # This software consists of voluntary contributions made by many
240 # individuals on behalf of the Apache Software Foundation. For more
241 # information on the Apache Software Foundation, please see
242 # <http://www.apache.org/>.
244 # Portions of this software are based upon public domain software
245 # originally written at the National Center for Supercomputing Applications,
246 # University of Illinois, Urbana-Champaign.