[COLOR=#008400][FONT=Menlo]#!/bin/sh[/FONT][/COLOR][COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# Licensed to the Apache Software Foundation (ASF) under one or more[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# contributor license agreements. See the NOTICE file distributed with[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# this work for additional information regarding copyright ownership.[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# The ASF licenses this file to You under the Apache License, Version 2.0[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# (the "License"); you may not use this file except in compliance with[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# the License. You may obtain a copy of the License at[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#1337FF][FONT=Menlo][COLOR=#008400]# [URL="http://www.apache.org/licenses/LICENSE-2.0"][COLOR=#1337ff]http://www.apache.org/licenses/LICENSE-2.0[/COLOR][/URL][/COLOR][/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# Unless required by applicable law or agreed to in writing, software[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# distributed under the License is distributed on an "AS IS" BASIS,[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# See the License for the specific language governing permissions and[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# limitations under the License.[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# Apache control script designed to allow an easy command line interface[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# to controlling Apache. Written by Marc Slemko, 1997/08/23[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# [/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# The exit codes returned are:[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# XXX this doc is no longer correct now that the interesting[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# XXX functions are handled by httpd[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 0 - operation completed successfully[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 1 - [/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 2 - usage error[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 3 - httpd could not be started[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 4 - httpd could not be stopped[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 5 - httpd could not be started during a restart[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 6 - httpd could not be restarted during a restart[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 7 - httpd could not be restarted during a graceful restart[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# 8 - configuration syntax error[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# When multiple arguments are given, only the error from the _last_[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# one is reported. Run "apachectl help" for usage info[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[FONT=Menlo]ARGV=[COLOR=#d12f1b]"$@"[/COLOR][/FONT]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# -------------------- --------------------[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# [/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# the path to your httpd binary, including options if necessary[/FONT][/COLOR]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000]HTTPD=[/COLOR]'/usr/sbin/httpd'[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# pick up any necessary environment variables[/FONT][/COLOR]
[FONT=Menlo][COLOR=#bb2ca2]if[/COLOR] test -f /usr/sbin/envvars; [COLOR=#bb2ca2]then[/COLOR][/FONT]
[FONT=Menlo] . /usr/sbin/envvars[/FONT]
[COLOR=#BB2CA2][FONT=Menlo]fi[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# a command that outputs a formatted text version of the HTML at the[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# url given on the command line. Designed for lynx, however other[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# programs may work. [/FONT][/COLOR]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000]LYNX=[/COLOR]"lynx -dump"[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# the URL to your server's mod_status status page. If you do not[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# have one, then status and fullstatus will not work.[/FONT][/COLOR]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000]STATUSURL=[/COLOR]"http://localhost:80/server-status"[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]#[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# Set this variable to a command that increases the maximum[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# number of file descriptors allowed per child process. This is[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# critical for configurations that use many file descriptors,[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# such as mass vhosting, or a multithreaded server.[/FONT][/COLOR]
[FONT=Menlo]ULIMIT_MAX_FILES=[COLOR=#d12f1b]""[/COLOR][/FONT]
[COLOR=#008400][FONT=Menlo]# -------------------- --------------------[/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000]LAUNCHCTL=[/COLOR]"/bin/launchctl"[/FONT][/COLOR]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000]LAUNCHD_JOB=[/COLOR]"/System/Library/LaunchDaemons/org.apache.httpd.plist"[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]run_launchctl() {[/FONT]
[FONT=Menlo] [COLOR=#bb2ca2]if[/COLOR] [ $UID != [COLOR=#272ad8]0[/COLOR] ]; [COLOR=#bb2ca2]then[/COLOR][/FONT]
[FONT=Menlo] echo This operation requires root.[/FONT]
[FONT=Menlo] [COLOR=#bb2ca2]exit[/COLOR] [COLOR=#272ad8]1[/COLOR][/FONT]
[FONT=Menlo] [COLOR=#bb2ca2]fi[/COLOR][/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo] $LAUNCHCTL $@[/FONT]
[FONT=Menlo]}[/FONT]
[FONT=Menlo]
[/FONT]
[COLOR=#008400][FONT=Menlo]# Set the maximum number of file descriptors allowed per child process.[/FONT][/COLOR]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#bb2ca2]if[/COLOR][COLOR=#000000] [ [/COLOR]"x$ULIMIT_MAX_FILES"[COLOR=#000000] != [/COLOR]"x"[COLOR=#000000] ] ; [/COLOR][COLOR=#bb2ca2]then[/COLOR][/FONT][/COLOR]
[FONT=Menlo] $ULIMIT_MAX_FILES[/FONT]
[COLOR=#BB2CA2][FONT=Menlo]fi[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]ERROR=[COLOR=#272ad8]0[/COLOR][/FONT]
[FONT=Menlo][COLOR=#bb2ca2]if[/COLOR] [ [COLOR=#d12f1b]"x$ARGV"[/COLOR] = [COLOR=#d12f1b]"x"[/COLOR] ] ; [COLOR=#bb2ca2]then[/COLOR] [/FONT]
[FONT=Menlo] ARGV=[COLOR=#d12f1b]"-h"[/COLOR][/FONT]
[COLOR=#BB2CA2][FONT=Menlo]fi[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#bb2ca2]case[/COLOR] $ARGV [COLOR=#bb2ca2]in[/COLOR][/FONT]
[FONT=Menlo]start)[/FONT]
[FONT=Menlo] run_launchctl load -w $LAUNCHD_JOB[/FONT]
[FONT=Menlo] ERROR=$?[/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]stop|graceful-stop)[/FONT]
[FONT=Menlo] run_launchctl unload -w $LAUNCHD_JOB[/FONT]
[FONT=Menlo] ERROR=$?[/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]restart|graceful)[/FONT]
[FONT=Menlo] run_launchctl unload -w $LAUNCHD_JOB [COLOR=#272ad8]2[/COLOR]> /dev/null[/FONT]
[FONT=Menlo] run_launchctl load -w $LAUNCHD_JOB[/FONT]
[FONT=Menlo] ERROR=$?[/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]startssl|sslstart|start-SSL)[/FONT]
[FONT=Menlo] echo The startssl option is no longer supported.[/FONT]
[FONT=Menlo] echo Please edit httpd.conf to include the SSL configuration settings[/FONT]
[FONT=Menlo] echo and [COLOR=#bb2ca2]then[/COLOR] use [COLOR=#d12f1b]"apachectl start"[/COLOR].[/FONT]
[FONT=Menlo] ERROR=[COLOR=#272ad8]2[/COLOR][/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]configtest)[/FONT]
[FONT=Menlo] $HTTPD -t[/FONT]
[FONT=Menlo] ERROR=$?[/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]status|fullstatus)[/FONT]
[FONT=Menlo] echo Go to $STATUSURL [COLOR=#bb2ca2]in[/COLOR] the web browser of your choice.[/FONT]
[FONT=Menlo] echo Note that mod_status must be enabled [COLOR=#bb2ca2]for[/COLOR] this to work.[/FONT]
[FONT=Menlo] ;;[/FONT]
[FONT=Menlo]*)[/FONT]
[FONT=Menlo] $HTTPD $ARGV[/FONT]
[FONT=Menlo] ERROR=$?[/FONT]
[COLOR=#BB2CA2][FONT=Menlo]esac[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#bb2ca2]exit[/COLOR] $ERROR