|
Packit |
90a5c9 |
#!/bin/sh
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
# contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
# this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
# (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
# the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
# See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
# limitations under the License.
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Apache control script designed to allow an easy command line interface
|
|
Packit |
90a5c9 |
# to controlling Apache. Written by Marc Slemko, 1997/08/23
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# The exit codes returned are:
|
|
Packit |
90a5c9 |
# XXX this doc is no longer correct now that the interesting
|
|
Packit |
90a5c9 |
# XXX functions are handled by httpd
|
|
Packit |
90a5c9 |
# 0 - operation completed successfully
|
|
Packit |
90a5c9 |
# 1 -
|
|
Packit |
90a5c9 |
# 2 - usage error
|
|
Packit |
90a5c9 |
# 3 - httpd could not be started
|
|
Packit |
90a5c9 |
# 4 - httpd could not be stopped
|
|
Packit |
90a5c9 |
# 5 - httpd could not be started during a restart
|
|
Packit |
90a5c9 |
# 6 - httpd could not be restarted during a restart
|
|
Packit |
90a5c9 |
# 7 - httpd could not be restarted during a graceful restart
|
|
Packit |
90a5c9 |
# 8 - configuration syntax error
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# When multiple arguments are given, only the error from the _last_
|
|
Packit |
90a5c9 |
# one is reported. Run "apachectl help" for usage info
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
ACMD="$1"
|
|
Packit |
90a5c9 |
ARGV="$@"
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
|
|
Packit |
90a5c9 |
# -------------------- --------------------
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# the path to your httpd binary, including options if necessary
|
|
Packit |
90a5c9 |
HTTPD='@exp_sbindir@/@progname@'
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# a command that outputs a formatted text version of the HTML at the
|
|
Packit |
90a5c9 |
# url given on the command line. Designed for lynx, however other
|
|
Packit |
90a5c9 |
# programs may work.
|
|
Packit |
48c19b |
if [ -x "@LYNX_PATH@" ]; then
|
|
Packit |
48c19b |
LYNX="@LYNX_PATH@ -dump"
|
|
Packit |
48c19b |
else
|
|
Packit |
48c19b |
LYNX=none
|
|
Packit |
48c19b |
fi
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# the URL to your server's mod_status status page. If you do not
|
|
Packit |
90a5c9 |
# have one, then status and fullstatus will not work.
|
|
Packit |
90a5c9 |
STATUSURL="http://localhost:@PORT@/server-status"
|
|
Packit |
48c19b |
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Set this variable to a command that increases the maximum
|
|
Packit |
90a5c9 |
# number of file descriptors allowed per child process. This is
|
|
Packit |
90a5c9 |
# critical for configurations that use many file descriptors,
|
|
Packit |
90a5c9 |
# such as mass vhosting, or a multithreaded server.
|
|
Packit |
90a5c9 |
ULIMIT_MAX_FILES="@APACHECTL_ULIMIT@"
|
|
Packit |
90a5c9 |
# -------------------- --------------------
|
|
Packit |
90a5c9 |
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
# Set the maximum number of file descriptors allowed per child process.
|
|
Packit |
90a5c9 |
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
|
|
Packit |
90a5c9 |
$ULIMIT_MAX_FILES
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
ERROR=0
|
|
Packit |
90a5c9 |
if [ "x$ARGV" = "x" ] ; then
|
|
Packit |
90a5c9 |
ARGV="-h"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
48c19b |
function checklynx() {
|
|
Packit |
48c19b |
if [ "$LYNX" = "none" ]; then
|
|
Packit |
48c19b |
echo "The 'links' package is required for this functionality."
|
|
Packit |
48c19b |
exit 8
|
|
Packit |
48c19b |
fi
|
|
Packit |
48c19b |
}
|
|
Packit |
48c19b |
|
|
Packit |
48c19b |
function testconfig() {
|
|
Packit |
48c19b |
# httpd is denied terminal access in SELinux, so run in the
|
|
Packit |
48c19b |
# current context to get stdout from $HTTPD -t.
|
|
Packit |
48c19b |
if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
|
|
Packit |
48c19b |
runcon -- `id -Z` /usr/sbin/httpd $OPTIONS -t
|
|
Packit |
48c19b |
else
|
|
Packit |
48c19b |
/usr/sbin/httpd $OPTIONS -t
|
|
Packit |
48c19b |
fi
|
|
Packit |
48c19b |
ERROR=$?
|
|
Packit |
48c19b |
}
|
|
Packit |
48c19b |
|
|
Packit |
48c19b |
if [ "x$2" != "x" ] ; then
|
|
Packit |
48c19b |
echo Passing arguments to httpd using apachectl is no longer supported.
|
|
Packit |
48c19b |
echo You can only start/stop/restart httpd using this script.
|
|
Packit |
48c19b |
echo If you want to pass extra arguments to httpd, edit the
|
|
Packit |
48c19b |
echo /etc/sysconfig/httpd config file.
|
|
Packit |
48c19b |
fi
|
|
Packit |
48c19b |
|
|
Packit |
90a5c9 |
case $ACMD in
|
|
Packit |
48c19b |
start|stop|restart|status)
|
|
Packit |
48c19b |
/usr/bin/systemctl $ACMD httpd.service
|
|
Packit |
48c19b |
ERROR=$?
|
|
Packit |
48c19b |
;;
|
|
Packit |
48c19b |
graceful)
|
|
Packit |
48c19b |
if /usr/bin/systemctl -q is-active httpd.service; then
|
|
Packit |
48c19b |
/usr/bin/systemctl reload httpd.service
|
|
Packit |
48c19b |
else
|
|
Packit |
48c19b |
/usr/bin/systemctl start httpd.service
|
|
Packit |
48c19b |
fi
|
|
Packit |
48c19b |
ERROR=$?
|
|
Packit |
48c19b |
;;
|
|
Packit |
48c19b |
graceful-stop)
|
|
Packit |
48c19b |
/usr/bin/systemctl stop httpd.service
|
|
Packit |
90a5c9 |
ERROR=$?
|
|
Packit |
90a5c9 |
;;
|
|
Packit |
90a5c9 |
startssl|sslstart|start-SSL)
|
|
Packit |
90a5c9 |
echo The startssl option is no longer supported.
|
|
Packit |
90a5c9 |
echo Please edit httpd.conf to include the SSL configuration settings
|
|
Packit |
90a5c9 |
echo and then use "apachectl start".
|
|
Packit |
90a5c9 |
ERROR=2
|
|
Packit |
90a5c9 |
;;
|
|
Packit |
90a5c9 |
configtest)
|
|
Packit |
48c19b |
testconfig
|
|
Packit |
90a5c9 |
;;
|
|
Packit |
90a5c9 |
fullstatus)
|
|
Packit |
48c19b |
checklynx
|
|
Packit |
90a5c9 |
$LYNX $STATUSURL
|
|
Packit |
90a5c9 |
;;
|
|
Packit |
90a5c9 |
*)
|
|
Packit |
48c19b |
/usr/sbin/httpd $OPTIONS "$@"
|
|
Packit |
90a5c9 |
ERROR=$?
|
|
Packit |
90a5c9 |
esac
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
exit $ERROR
|
|
Packit |
90a5c9 |
|