You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
435 B
17 lines
435 B
#!/bin/bash
|
|
if [ "$WAIT_DB" != true ]; then
|
|
log INFO Not waiting for a postgres server
|
|
exit 0
|
|
fi
|
|
|
|
log INFO Waiting until postgres is listening at $PGHOST...
|
|
while true; do
|
|
if [ -n "$PGDATABASE" ]; then
|
|
echo "SELECT 1;" | psql "$PGDATABASE"
|
|
else
|
|
# Assumes that your access level to postgres includes the
|
|
# right to list databases
|
|
psql -l
|
|
fi > /dev/null 2>&1 && break
|
|
sleep 1
|
|
done
|