aboutsummaryrefslogtreecommitdiff
path: root/docker/haproxy/extend_start.sh
blob: e2d13f4840b723acda8ddbfa25a7698b3746e4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

# We are intentionally not using exec so we can reload the haproxy config later
echo "Running command: '${CMD}'"
$CMD

retry=0
# The loop breaks only when haproxy.pid get missing even after 3 re-try.
while [[ $retry -lt 3 ]]; do
    if [[ ! -e /run/haproxy.pid || ! -d /proc/$(cat /run/haproxy.pid) ]]; then
        retry=$((retry+1))
        sleep 2
        continue
    fi
    retry=0
    sleep 5
done

exit 1