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