source: mod_gnutls/test/proxy_backend.bash @ f84890d

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

Shared bash file for proxy back end management code

Futher test cases for proxy operation will need this code as well, so it makes
sense to keep it in a common file that individual test scripts can parse.

  • Property mode set to 100644
File size: 879 bytes
Line 
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
14if [ -z "${BACKEND_LOCK}" ] && [ -n "${testdir}" ]; then
15    BACKEND_LOCK="$(realpath ${testdir}/backend.lock)"
16fi
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}"
34        case $action in
35            start)
36                cd "${dir}"
37                ${flock_cmd} \
38                    /usr/sbin/apache2 -f "$(pwd)/${conf}" -k start || return 1
39                ;;
40            stop)
41                cd "${dir}"
42                /usr/sbin/apache2 -f "$(pwd)/${conf}" -k stop || return 1
43                ;;
44        esac
45    )
46}
Note: See TracBrowser for help on using the repository browser.