1--- docs/man/apachectl.8.orig	2005-09-20 07:54:17.000000000 -0700
2+++ docs/man/apachectl.8	2008-07-15 13:09:46.000000000 -0700
3@@ -62,13 +62,13 @@
4  
5 .TP
6 start
7-Start the Apache httpd daemon\&. Gives an error if it is already running\&. This is equivalent to apachectl -k start\&.  
8+Loads the org\&.apache\&.httpd launchd job\&.
9 .TP
10-stop
11-Stops the Apache httpd daemon\&. This is equivalent to apachectl -k stop\&.  
12+stop, graceful-stop
13+Unloads the org\&.apache\&.httpd launchd job\&.
14 .TP
15-restart
16-Restarts the Apache httpd daemon\&. If the daemon is not running, it is started\&. This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn't die\&. This is equivalent to apachectl -k restart\&.  
17+restart, graceful
18+Unloads, then loads the org\&.apache\&.httpd launchd job\&.
19 .TP
20 fullstatus
21 Displays a full status report from mod_status\&. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynx available on your system\&. The URL used to access the status report can be set by editing the STATUSURL variable in the script\&.  
22@@ -76,12 +76,6 @@
23 status
24 Displays a brief status report\&. Similar to the fullstatus option, except that the list of requests currently being served is omitted\&.  
25 .TP
26-graceful
27-Gracefully restarts the Apache httpd daemon\&. If the daemon is not running, it is started\&. This differs from a normal restart in that currently open connections are not aborted\&. A side effect is that old log files will not be closed immediately\&. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them\&. This command automatically checks the configuration files as in configtest before initiating the restart to make sure Apache doesn't die\&. This is equivalent to apachectl -k graceful\&.  
28-.TP
29-graceful-stop
30-Gracefully stops the Apache httpd daemon\&. This differs from a normal stop in that currently open connections are not aborted\&. A side effect is that old log files will not be closed immediately\&. This is equivalent to apachectl -k graceful-stop\&.  
31-.TP
32 configtest
33 Run a configuration file syntax test\&. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error\&. This is equivalent to apachectl -t\&.  
34  
35--- support/apachectl.in.orig	2006-07-11 20:38:44.000000000 -0700
36+++ support/apachectl.in	2008-07-15 13:21:50.000000000 -0700
37@@ -65,6 +65,18 @@
38 # --------------------                              --------------------
39 # ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||
40 
41+LAUNCHCTL="/bin/launchctl"
42+LAUNCHD_JOB="/System/Library/LaunchDaemons/org.apache.httpd.plist"
43+
44+run_launchctl() {
45+    if [ $UID != 0 ]; then
46+        echo This operation requires root.
47+        exit 1
48+    fi
49+
50+    $LAUNCHCTL $@
51+}
52+
53 # Set the maximum number of file descriptors allowed per child process.
54 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
55     $ULIMIT_MAX_FILES
56@@ -76,8 +88,17 @@
57 fi
58 
59 case $ARGV in
60-start|stop|restart|graceful|graceful-stop)
61-    $HTTPD -k $ARGV
62+start)
63+    run_launchctl load -w $LAUNCHD_JOB
64+    ERROR=$?
65+    ;;
66+stop|graceful-stop)
67+    run_launchctl unload -w $LAUNCHD_JOB
68+    ERROR=$?
69+    ;;
70+restart|graceful)
71+    run_launchctl unload -w $LAUNCHD_JOB 2> /dev/null
72+    run_launchctl load -w $LAUNCHD_JOB
73     ERROR=$?
74     ;;
75 startssl|sslstart|start-SSL)
76@@ -90,11 +111,9 @@
77     $HTTPD -t
78     ERROR=$?
79     ;;
80-status)
81-    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
82-    ;;
83-fullstatus)
84-    $LYNX $STATUSURL
85+status|fullstatus)
86+    echo Go to $STATUSURL in the web browser of your choice.
87+    echo Note that mod_status must be enabled for this to work.
88     ;;
89 *)
90     $HTTPD $ARGV
91