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 74771ea2a9 plpgsql: support Travis run with alt. user
Seems that Travis sometimes runs with a user other than 1001 so add
user ID 2000 as well.
2017-07-25 11:13:13 -05:00

26 lines
546 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} \
bash -c "/usr/lib/postgresql/9.4/bin/postgres \
-c config_file=/etc/postgresql/9.4/main/postgresql.conf \
${POPTS} >/var/log/postgresql/output.log 2>&1" & disown -h
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