]> granicus.if.org Git - apache/blob - support/apachectl.in
Revert the change in the previous commit, which broke the
[apache] / support / apachectl.in
1 #!/bin/sh
2 #
3 # Copyright (c) 2000-2002 The Apache Software Foundation.
4 # See license at the end of this file.
5 #
6 # Apache control script designed to allow an easy command line interface
7 # to controlling Apache.  Written by Marc Slemko, 1997/08/23
8
9 # The exit codes returned are:
10 #   XXX this doc is no longer correct now that the interesting
11 #   XXX functions are handled by httpd
12 #       0 - operation completed successfully
13 #       1 - 
14 #       2 - usage error
15 #       3 - httpd could not be started
16 #       4 - httpd could not be stopped
17 #       5 - httpd could not be started during a restart
18 #       6 - httpd could not be restarted during a restart
19 #       7 - httpd could not be restarted during a graceful restart
20 #       8 - configuration syntax error
21 #
22 # When multiple arguments are given, only the error from the _last_
23 # one is reported.  Run "apachectl help" for usage info
24 #
25 ARGV="$@"
26 #
27 # |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
28 # --------------------                              --------------------
29
30 # the path to your httpd binary, including options if necessary
31 HTTPD='@exp_sbindir@/@progname@'
32 #
33 # pick up any necessary environment variables
34 if test -f @exp_bindir@/envvars; then
35   . @exp_bindir@/envvars
36 fi
37 #
38 # a command that outputs a formatted text version of the HTML at the
39 # url given on the command line.  Designed for lynx, however other
40 # programs may work.  
41 LYNX="lynx -dump"
42 #
43 # the URL to your server's mod_status status page.  If you do not
44 # have one, then status and fullstatus will not work.
45 STATUSURL="http://localhost:@PORT@/server-status"
46 #
47 # Set this variable to a command that increases the maximum
48 # number of file descriptors allowed per child process. This is
49 # critical for configurations that use many file descriptors,
50 # such as mass vhosting, or a multithreaded server.
51 ULIMIT_MAX_FILES="@APACHECTL_ULIMIT@"
52 # --------------------                              --------------------
53 # ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||
54
55 # Set the maximum number of file descriptors allowed per child process.
56 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
57     $ULIMIT_MAX_FILES
58 fi
59
60 ERROR=0
61 if [ "x$ARGV" = "x" ] ; then 
62     ARGV="-h"
63 fi
64
65 case $ARGV in
66 start|stop|restart|graceful)
67     $HTTPD -k $ARGV
68     ERROR=$?
69     ;;
70 startssl|sslstart|start-SSL)
71     $HTTPD -k start -DSSL
72     ERROR=$?
73     ;;
74 configtest)
75     $HTTPD -t
76     ERROR=$?
77     ;;
78 status)
79     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
80     ;;
81 fullstatus)
82     $LYNX $STATUSURL
83     ;;
84 *)
85     $HTTPD $ARGV
86     ERROR=$?
87 esac
88
89 exit $ERROR
90
91 # ====================================================================
92 # The Apache Software License, Version 1.1
93 #
94 # Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
95 # reserved.
96 #
97 # Redistribution and use in source and binary forms, with or without
98 # modification, are permitted provided that the following conditions
99 # are met:
100 #
101 # 1. Redistributions of source code must retain the above copyright
102 #    notice, this list of conditions and the following disclaimer.
103 #
104 # 2. Redistributions in binary form must reproduce the above copyright
105 #    notice, this list of conditions and the following disclaimer in
106 #    the documentation and/or other materials provided with the
107 #    distribution.
108 #
109 # 3. The end-user documentation included with the redistribution,
110 #    if any, must include the following acknowledgment:
111 #       "This product includes software developed by the
112 #        Apache Software Foundation (http://www.apache.org/)."
113 #    Alternately, this acknowledgment may appear in the software itself,
114 #    if and wherever such third-party acknowledgments normally appear.
115 #
116 # 4. The names "Apache" and "Apache Software Foundation" must
117 #    not be used to endorse or promote products derived from this
118 #    software without prior written permission. For written
119 #    permission, please contact apache@apache.org.
120 #
121 # 5. Products derived from this software may not be called "Apache",
122 #    nor may "Apache" appear in their name, without prior written
123 #    permission of the Apache Software Foundation.
124 #
125 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
126 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
127 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
128 # DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
129 # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
130 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
131 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
132 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
133 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
134 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
135 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
136 # SUCH DAMAGE.
137 # ====================================================================
138 #
139 # This software consists of voluntary contributions made by many
140 # individuals on behalf of the Apache Software Foundation.  For more
141 # information on the Apache Software Foundation, please see
142 # <http://www.apache.org/>.
143 #
144 # Portions of this software are based upon public domain software
145 # originally written at the National Center for Supercomputing Applications,
146 # University of Illinois, Urbana-Champaign.
147 #