]> granicus.if.org Git - apache/blob - support/apachectl.in
Merge r1351737 from trunk:
[apache] / support / apachectl.in
1 #!/bin/sh
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 # 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 ACMD="$1"
39 ARGV="$@"
40 #
41 # |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
42 # --------------------                              --------------------
43
44 # the path to your httpd binary, including options if necessary
45 HTTPD='@exp_sbindir@/@progname@'
46 #
47 # pick up any necessary environment variables
48 if test -f @exp_sbindir@/envvars; then
49   . @exp_sbindir@/envvars
50 fi
51 #
52 # a command that outputs a formatted text version of the HTML at the
53 # url given on the command line.  Designed for lynx, however other
54 # programs may work.  
55 LYNX="@LYNX_PATH@ -dump"
56 #
57 # the URL to your server's mod_status status page.  If you do not
58 # have one, then status and fullstatus will not work.
59 STATUSURL="http://localhost:@PORT@/server-status"
60 #
61 # Set this variable to a command that increases the maximum
62 # number of file descriptors allowed per child process. This is
63 # critical for configurations that use many file descriptors,
64 # such as mass vhosting, or a multithreaded server.
65 ULIMIT_MAX_FILES="@APACHECTL_ULIMIT@"
66 # --------------------                              --------------------
67 # ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||
68
69 # Set the maximum number of file descriptors allowed per child process.
70 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
71     $ULIMIT_MAX_FILES
72 fi
73
74 ERROR=0
75 if [ "x$ARGV" = "x" ] ; then 
76     ARGV="-h"
77 fi
78
79 case $ACMD in
80 start|stop|restart|graceful|graceful-stop)
81     $HTTPD -k $ARGV
82     ERROR=$?
83     ;;
84 startssl|sslstart|start-SSL)
85     echo The startssl option is no longer supported.
86     echo Please edit httpd.conf to include the SSL configuration settings
87     echo and then use "apachectl start".
88     ERROR=2
89     ;;
90 configtest)
91     $HTTPD -t
92     ERROR=$?
93     ;;
94 status)
95     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
96     ;;
97 fullstatus)
98     $LYNX $STATUSURL
99     ;;
100 *)
101     $HTTPD "$@"
102     ERROR=$?
103 esac
104
105 exit $ERROR
106