altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.35-apachectl.patch

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