Merge pull request #217 from dubek/lua-interop
[jackhill/mal.git] / plpgsql / entrypoint.sh
CommitLineData
08e44c41
JM
1#!/bin/bash
2
67cc8a15
JM
3POSTGRES_SUDO_USER=${POSTGRES_SUDO_USER:-postgres}
4
08e44c41
JM
5POPTS=""
6while [[ ${1:0:1} = '-' ]]; do
7 POPTS="${POPTS}$1 $2"
8 shift; shift
9done
10
67cc8a15
JM
11sudo --user=${POSTGRES_SUDO_USER} \
12 /usr/lib/postgresql/9.4/bin/postgres \
08e44c41 13 -c config_file=/etc/postgresql/9.4/main/postgresql.conf \
494792ab 14 ${POPTS} >/var/log/postgresql/output.log 2>&1 & disown -h
08e44c41
JM
15
16while ! ( echo "" > /dev/tcp/localhost/5432) 2>/dev/null; do
17 echo "Waiting for postgres to start"
18 sleep 1
19done
20
21if [ "${*}" ]; then
22 exec "${@}"
23else
24 exec bash
25fi