]> granicus.if.org Git - apache/blob - support/apachectl.in
Merged the simple-conf branch changes r159781:160695 into the trunk.
[apache] / support / apachectl.in
1 #!/bin/sh
2 #
3 # Copyright 2000-2005 The Apache Software Foundation or its licensors, as
4 # applicable.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # 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 # Apache control script designed to allow an easy command line interface
20 # to controlling Apache.  Written by Marc Slemko, 1997/08/23
21
22 # The exit codes returned are:
23 #   XXX this doc is no longer correct now that the interesting
24 #   XXX functions are handled by httpd
25 #       0 - operation completed successfully
26 #       1 - 
27 #       2 - usage error
28 #       3 - httpd could not be started
29 #       4 - httpd could not be stopped
30 #       5 - httpd could not be started during a restart
31 #       6 - httpd could not be restarted during a restart
32 #       7 - httpd could not be restarted during a graceful restart
33 #       8 - configuration syntax error
34 #
35 # When multiple arguments are given, only the error from the _last_
36 # one is reported.  Run "apachectl help" for usage info
37 #
38 ARGV="$@"
39 #
40 # |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
41 # --------------------                              --------------------
42
43 # the path to your httpd binary, including options if necessary
44 HTTPD='@exp_sbindir@/@progname@'
45 #
46 # pick up any necessary environment variables
47 if test -f @exp_sbindir@/envvars; then
48   . @exp_sbindir@/envvars
49 fi
50 #
51 # a command that outputs a formatted text version of the HTML at the
52 # url given on the command line.  Designed for lynx, however other
53 # programs may work.  
54 LYNX="@LYNX_PATH@ -dump"
55 #
56 # the URL to your server's mod_status status page.  If you do not
57 # have one, then status and fullstatus will not work.
58 STATUSURL="http://localhost:@PORT@/server-status"
59 #
60 # Set this variable to a command that increases the maximum
61 # number of file descriptors allowed per child process. This is
62 # critical for configurations that use many file descriptors,
63 # such as mass vhosting, or a multithreaded server.
64 ULIMIT_MAX_FILES="@APACHECTL_ULIMIT@"
65 # --------------------                              --------------------
66 # ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||
67
68 # Set the maximum number of file descriptors allowed per child process.
69 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
70     $ULIMIT_MAX_FILES
71 fi
72
73 ERROR=0
74 if [ "x$ARGV" = "x" ] ; then 
75     ARGV="-h"
76 fi
77
78 case $ARGV in
79 start|stop|restart|graceful)
80     $HTTPD -k $ARGV
81     ERROR=$?
82     ;;
83 startssl|sslstart|start-SSL)
84     echo The startssl option is no longer supported.
85     echo Please edit httpd.conf to include the SSL configuration settings
86     echo and then use "apachectl start".
87     ERROR=2
88     ;;
89 configtest)
90     $HTTPD -t
91     ERROR=$?
92     ;;
93 status)
94     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
95     ;;
96 fullstatus)
97     $LYNX $STATUSURL
98     ;;
99 *)
100     $HTTPD $ARGV
101     ERROR=$?
102 esac
103
104 exit $ERROR
105