1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 10:37:58 +03:00
mal/plpgsql/entrypoint.sh
Joel Martin 67cc8a15a2 plpgsql: try again with Travis user/sudo permissions.
This time sudo inside the entrypoint only for starting postgres
service.
2016-05-02 23:37:16 -05:00

26 lines
489 B
Bash
Executable File

#!/bin/bash
POSTGRES_SUDO_USER=${POSTGRES_SUDO_USER:-postgres}
POPTS=""
while [[ ${1:0:1} = '-' ]]; do
POPTS="${POPTS}$1 $2"
shift; shift
done
sudo --user=${POSTGRES_SUDO_USER} \
/usr/lib/postgresql/9.4/bin/postgres \
-c config_file=/etc/postgresql/9.4/main/postgresql.conf \
${POPTS} &
while ! ( echo "" > /dev/tcp/localhost/5432) 2>/dev/null; do
echo "Waiting for postgres to start"
sleep 1
done
if [ "${*}" ]; then
exec "${@}"
else
exec bash
fi