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