|
|
52592b |
diff --git a/docs/man/apachectl.8 b/docs/man/apachectl.8
|
|
|
52592b |
index 870a048..32d3ee5 100644
|
|
|
52592b |
--- a/docs/man/apachectl.8
|
|
|
52592b |
+++ b/docs/man/apachectl.8
|
|
|
52592b |
@@ -74,7 +74,7 @@ Restarts the Apache httpd daemon\&. If the daemon is not running, it is started\
|
|
|
52592b |
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 \fBlynx\fR available on your system\&. The URL used to access the status report can be set by editing the \fBSTATUSURL\fR variable in the script\&.
|
|
|
52592b |
.TP
|
|
|
52592b |
\fBstatus\fR
|
|
|
52592b |
-Displays a brief status report\&. Similar to the \fBfullstatus\fR option, except that the list of requests currently being served is omitted\&.
|
|
|
52592b |
+Displays a brief status report using systemd\&.
|
|
|
52592b |
.TP
|
|
|
52592b |
\fBgraceful\fR
|
|
|
52592b |
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 \fBconfigtest\fR before initiating the restart to make sure Apache doesn't die\&. This is equivalent to \fBapachectl -k graceful\fR\&.
|
|
|
52592b |
diff --git a/support/apachectl.in b/support/apachectl.in
|
|
|
52592b |
index 3281c2e..8ce6f2b 100644
|
|
|
52592b |
--- a/support/apachectl.in
|
|
|
52592b |
+++ b/support/apachectl.in
|
|
|
52592b |
@@ -44,19 +44,20 @@ ARGV="$@"
|
|
|
52592b |
# the path to your httpd binary, including options if necessary
|
|
|
52592b |
HTTPD='@exp_sbindir@/@progname@'
|
|
|
52592b |
#
|
|
|
52592b |
-# pick up any necessary environment variables
|
|
|
52592b |
-if test -f @exp_sbindir@/envvars; then
|
|
|
52592b |
- . @exp_sbindir@/envvars
|
|
|
52592b |
-fi
|
|
|
52592b |
#
|
|
|
52592b |
# a command that outputs a formatted text version of the HTML at the
|
|
|
52592b |
# url given on the command line. Designed for lynx, however other
|
|
|
52592b |
# programs may work.
|
|
|
52592b |
-LYNX="@LYNX_PATH@ -dump"
|
|
|
52592b |
+if [ -x "@LYNX_PATH@" ]; then
|
|
|
52592b |
+ LYNX="@LYNX_PATH@ -dump"
|
|
|
52592b |
+else
|
|
|
52592b |
+ LYNX=none
|
|
|
52592b |
+fi
|
|
|
52592b |
#
|
|
|
52592b |
# the URL to your server's mod_status status page. If you do not
|
|
|
52592b |
# have one, then status and fullstatus will not work.
|
|
|
52592b |
STATUSURL="http://localhost:@PORT@/server-status"
|
|
|
52592b |
+
|
|
|
52592b |
#
|
|
|
52592b |
# Set this variable to a command that increases the maximum
|
|
|
52592b |
# number of file descriptors allowed per child process. This is
|
|
|
52592b |
@@ -76,9 +77,46 @@ if [ "x$ARGV" = "x" ] ; then
|
|
|
52592b |
ARGV="-h"
|
|
|
52592b |
fi
|
|
|
52592b |
|
|
|
52592b |
+function checklynx() {
|
|
|
52592b |
+if [ "$LYNX" = "none" ]; then
|
|
|
52592b |
+ echo "The 'links' package is required for this functionality."
|
|
|
52592b |
+ exit 8
|
|
|
52592b |
+fi
|
|
|
52592b |
+}
|
|
|
52592b |
+
|
|
|
52592b |
+function testconfig() {
|
|
|
52592b |
+# httpd is denied terminal access in SELinux, so run in the
|
|
|
52592b |
+# current context to get stdout from $HTTPD -t.
|
|
|
52592b |
+if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
|
|
|
52592b |
+ runcon -- `id -Z` /usr/sbin/httpd $OPTIONS -t
|
|
|
52592b |
+else
|
|
|
52592b |
+ /usr/sbin/httpd $OPTIONS -t
|
|
|
52592b |
+fi
|
|
|
52592b |
+ERROR=$?
|
|
|
52592b |
+}
|
|
|
52592b |
+
|
|
|
52592b |
+if [ "x$2" != "x" ] ; then
|
|
|
52592b |
+ echo Passing arguments to httpd using apachectl is no longer supported.
|
|
|
52592b |
+ echo You can only start/stop/restart httpd using this script.
|
|
|
52592b |
+ echo If you want to pass extra arguments to httpd, edit the
|
|
|
52592b |
+ echo /etc/sysconfig/httpd config file.
|
|
|
52592b |
+fi
|
|
|
52592b |
+
|
|
|
52592b |
case $ACMD in
|
|
|
52592b |
-start|stop|restart|graceful|graceful-stop)
|
|
|
52592b |
- $HTTPD -k $ARGV
|
|
|
52592b |
+start|stop|restart|status)
|
|
|
52592b |
+ /usr/bin/systemctl $ACMD httpd.service
|
|
|
52592b |
+ ERROR=$?
|
|
|
52592b |
+ ;;
|
|
|
52592b |
+graceful)
|
|
|
52592b |
+ if /usr/bin/systemctl -q is-active httpd.service; then
|
|
|
52592b |
+ /usr/bin/systemctl reload httpd.service
|
|
|
52592b |
+ else
|
|
|
52592b |
+ /usr/bin/systemctl start httpd.service
|
|
|
52592b |
+ fi
|
|
|
52592b |
+ ERROR=$?
|
|
|
52592b |
+ ;;
|
|
|
52592b |
+graceful-stop)
|
|
|
52592b |
+ /usr/bin/systemctl stop httpd.service
|
|
|
52592b |
ERROR=$?
|
|
|
52592b |
;;
|
|
|
52592b |
startssl|sslstart|start-SSL)
|
|
|
52592b |
@@ -88,17 +126,14 @@ startssl|sslstart|start-SSL)
|
|
|
52592b |
ERROR=2
|
|
|
52592b |
;;
|
|
|
52592b |
configtest)
|
|
|
52592b |
- $HTTPD -t
|
|
|
52592b |
- ERROR=$?
|
|
|
52592b |
- ;;
|
|
|
52592b |
-status)
|
|
|
52592b |
- $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
|
|
|
52592b |
+ testconfig
|
|
|
52592b |
;;
|
|
|
52592b |
fullstatus)
|
|
|
52592b |
+ checklynx
|
|
|
52592b |
$LYNX $STATUSURL
|
|
|
52592b |
;;
|
|
|
52592b |
*)
|
|
|
52592b |
- $HTTPD "$@"
|
|
|
52592b |
+ /usr/sbin/httpd $OPTIONS "$@"
|
|
|
52592b |
ERROR=$?
|
|
|
52592b |
esac
|
|
|
52592b |
|