b86b48c
#!/usr/bin/sh
b86b48c
#
b86b48c
# Licensed to the Apache Software Foundation (ASF) under one or more
b86b48c
# contributor license agreements.  See the NOTICE file distributed with
b86b48c
# this work for additional information regarding copyright ownership.
b86b48c
# The ASF licenses this file to You under the Apache License, Version 2.0
b86b48c
# (the "License"); you may not use this file except in compliance with
b86b48c
# the License.  You may obtain a copy of the License at
b86b48c
#
b86b48c
#     http://www.apache.org/licenses/LICENSE-2.0
b86b48c
#
b86b48c
# Unless required by applicable law or agreed to in writing, software
b86b48c
# distributed under the License is distributed on an "AS IS" BASIS,
b86b48c
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b86b48c
# See the License for the specific language governing permissions and
b86b48c
# limitations under the License.
b86b48c
0da2026
###
0da2026
### NOTE: This is a replacement version of the "apachectl" script with
0da2026
### some differences in behaviour to the version distributed with
0da2026
### Apache httpd.  Please read the apachectl(8) man page for more
0da2026
### information.
0da2026
###
0da2026
b86b48c
if [ "x$1" = "x-k" ]; then
b86b48c
    shift
b86b48c
fi
b86b48c
b86b48c
ACMD="$1"
b86b48c
ARGV="$@"
b86b48c
SVC='httpd.service'
bc95575
HTTPD='@HTTPDBIN@'
b86b48c
b86b48c
if [ "x$2" != "x" ] ; then
b86b48c
    echo Passing arguments to httpd using apachectl is no longer supported.
b86b48c
    echo You can only start/stop/restart httpd using this script.
b86b48c
    echo To pass extra arguments to httpd, see the $SVC'(8)'
b86b48c
    echo man page.
b86b48c
    exit 1
b86b48c
fi
b86b48c
b86b48c
case $ACMD in
b86b48c
start|stop|restart|status)
b86b48c
    /usr/bin/systemctl --no-pager $ACMD $SVC
b86b48c
    ERROR=$?
b86b48c
    ;;
b86b48c
graceful)
b86b48c
    if /usr/bin/systemctl -q is-active $SVC; then
9d23b8b
        /usr/bin/systemctl kill --signal=SIGUSR1 --kill-who=main $SVC
b86b48c
    else
b86b48c
        /usr/bin/systemctl start $SVC
b86b48c
    fi
b86b48c
    ERROR=$?
b86b48c
    ;;
b86b48c
graceful-stop)
9d23b8b
    /usr/bin/systemctl kill --signal=SIGWINCH --kill-who=main $SVC
b86b48c
    ERROR=$?
b86b48c
    ;;
7ee1cb5
configtest|-t)
bc95575
    $HTTPD -t
b86b48c
    ERROR=$?
b86b48c
    ;;
7ee1cb5
-v|-V)
7ee1cb5
    $HTTPD $ACMD
7ee1cb5
    ERROR=$?
7ee1cb5
    ;;
b86b48c
*)
b86b48c
    echo apachectl: The \"$ACMD\" option is not supported. 1>&2
b86b48c
    ERROR=2
b86b48c
    ;;
b86b48c
esac
b86b48c
b86b48c
exit $ERROR
b86b48c