3 # Copyright (c) 2000-2002 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
25 # |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
26 # -------------------- --------------------
28 # the path to your PID file
29 PIDFILE=@exp_runtimedir@/@progname@.pid
31 # the path to your httpd binary, including options if necessary
32 HTTPD='@exp_bindir@/@progname@'
34 # pick up any necessary environment variables
35 if test -f @exp_bindir@/envvars; then
36 . @exp_bindir@/envvars
39 # a command that outputs a formatted text version of the HTML at the
40 # url given on the command line. Designed for lynx, however other
44 # the URL to your server's mod_status status page. If you do not
45 # have one, then status and fullstatus will not work.
46 STATUSURL="http://localhost:@PORT@/server-status"
48 # -------------------- --------------------
49 # |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
52 if [ "x$ARGV" = "x" ] ; then
56 for ARG in $ARGV $ARGS
59 if [ -f $PIDFILE ] ; then
61 if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
62 STATUS="@progname@ (pid $PID) running"
65 STATUS="@progname@ (pid $PID?) not running"
69 STATUS="@progname@ (no pid file) not running"
75 if [ $RUNNING -eq 1 ]; then
76 echo "$0 $ARG: @progname@ (pid $PID) already running"
80 echo "$0 $ARG: @progname@ started"
82 echo "$0 $ARG: @progname@ could not be started"
86 startssl|sslstart|start-SSL)
87 if [ $RUNNING -eq 1 ]; then
88 echo "$0 $ARG: @progname@ (pid $PID) already running"
92 echo "$0 $ARG: @progname@ started"
94 echo "$0 $ARG: @progname@ could not be started"
99 if [ $RUNNING -eq 0 ]; then
100 echo "$0 $ARG: $STATUS"
104 echo "$0 $ARG: @progname@ stopped"
106 echo "$0 $ARG: @progname@ could not be stopped"
111 if [ $RUNNING -eq 0 ]; then
112 echo "$0 $ARG: @progname@ not running, trying to start"
114 echo "$0 $ARG: @progname@ started"
116 echo "$0 $ARG: @progname@ could not be started"
120 if $HTTPD -t >/dev/null 2>&1; then
121 if kill -HUP $PID ; then
122 echo "$0 $ARG: @progname@ restarted"
124 echo "$0 $ARG: @progname@ could not be restarted"
128 echo "$0 $ARG: configuration broken, ignoring restart"
129 echo "$0 $ARG: (run 'apachectl configtest' for details)"
135 if [ $RUNNING -eq 0 ]; then
136 echo "$0 $ARG: @progname@ not running, trying to start"
138 echo "$0 $ARG: @progname@ started"
140 echo "$0 $ARG: @progname@ could not be started"
144 if $HTTPD -t >/dev/null 2>&1; then
145 if kill -@AP_SIG_GRACEFUL_SHORT@ $PID ; then
146 echo "$0 $ARG: @progname@ gracefully restarted"
148 echo "$0 $ARG: @progname@ could not be restarted"
152 echo "$0 $ARG: configuration broken, ignoring restart"
153 echo "$0 $ARG: (run 'apachectl configtest' for details)"
159 $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
172 echo "usage: $0 (start|stop|restart|fullstatus|status|graceful|configtest|help)"
175 start - start @progname@
176 startssl - start @progname@ with SSL enabled
177 stop - stop @progname@
178 restart - restart @progname@ if running by sending a SIGHUP or start if
180 fullstatus - dump a full status screen; requires lynx and mod_status enabled
181 status - dump a short status screen; requires lynx and mod_status enabled
182 graceful - do a graceful restart by sending a @AP_SIG_GRACEFUL@ or start if not running
183 configtest - do a configuration syntax test
196 # ====================================================================
197 # The Apache Software License, Version 1.1
199 # Copyright (c) 2000-2002 The Apache Software Foundation. All rights
202 # Redistribution and use in source and binary forms, with or without
203 # modification, are permitted provided that the following conditions
206 # 1. Redistributions of source code must retain the above copyright
207 # notice, this list of conditions and the following disclaimer.
209 # 2. Redistributions in binary form must reproduce the above copyright
210 # notice, this list of conditions and the following disclaimer in
211 # the documentation and/or other materials provided with the
214 # 3. The end-user documentation included with the redistribution,
215 # if any, must include the following acknowledgment:
216 # "This product includes software developed by the
217 # Apache Software Foundation (http://www.apache.org/)."
218 # Alternately, this acknowledgment may appear in the software itself,
219 # if and wherever such third-party acknowledgments normally appear.
221 # 4. The names "Apache" and "Apache Software Foundation" must
222 # not be used to endorse or promote products derived from this
223 # software without prior written permission. For written
224 # permission, please contact apache@apache.org.
226 # 5. Products derived from this software may not be called "Apache",
227 # nor may "Apache" appear in their name, without prior written
228 # permission of the Apache Software Foundation.
230 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
231 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
232 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
233 # DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
234 # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
235 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
237 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
238 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
239 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
240 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
242 # ====================================================================
244 # This software consists of voluntary contributions made by many
245 # individuals on behalf of the Apache Software Foundation. For more
246 # information on the Apache Software Foundation, please see
247 # <http://www.apache.org/>.
249 # Portions of this software are based upon public domain software
250 # originally written at the National Center for Supercomputing Applications,
251 # University of Illinois, Urbana-Champaign.