source: mod_gnutls/test/proxy_backend.bash @ 52c3f68

debian/masterdebian/stretch-backportsjessie-backportsupstream
Last change on this file since 52c3f68 was 52c3f68, checked in by Thomas Klute <thomas2.klute@…>, 5 years ago

Detect apache(2?)ctl and use it instead of starting Apache directly

This should help with portability across distributions that install the
Apache binary under different paths.

  • Property mode set to 100644
File size: 876 bytes
RevLine 
[f84890d]1#!/bin/bash
2
3set -e
4
5if [ -z "${BACKEND_HOST}" ]; then
6    export BACKEND_HOST="localhost"
7fi
8if [ -z "${BACKEND_IP}" ]; then
9    export BACKEND_IP="::1"
10fi
11if [ -z "${BACKEND_PORT}" ]; then
12    export BACKEND_PORT="9934"
13fi
[33af2b7]14: ${BACKEND_LOCK:="backend.lock"}
15: ${srcdir:="."}
[52c3f68]16: ${APACHECTL:="apachectl"}
[f84890d]17
18function backend_apache
19{
20    dir="${1}"
21    conf="${2}"
22    action="${3}"
23    lockfile="${4}"
24
25    if [ -n "${lockfile}" ]; then
26        flock_cmd="flock -w 10 ${lockfile}"
27    fi
28
29    TEST_NAME="$(basename "${dir}")"
30    (
31        export TEST_NAME
32        export TEST_IP="${BACKEND_IP}"
33        export TEST_PORT="${BACKEND_PORT}"
[33af2b7]34        export srcdir="$(realpath ${srcdir})"
[f84890d]35        case $action in
36            start)
37                ${flock_cmd} \
[52c3f68]38                    ${APACHECTL} -f "$(realpath ${testdir}/${conf})" -k start || return 1
[f84890d]39                ;;
40            stop)
[52c3f68]41                ${APACHECTL} -f "$(realpath ${testdir}/${conf})" -k stop || return 1
[f84890d]42                ;;
43        esac
44    )
45}
Note: See TracBrowser for help on using the repository browser.