mirror of
https://github.com/kanaka/mal.git
synced 2024-11-13 11:23:59 +03:00
67cc8a15a2
This time sudo inside the entrypoint only for starting postgres service.
26 lines
489 B
Bash
Executable File
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
|