mirror of
https://github.com/solero/wand.git
synced 2024-11-28 00:17:22 +00:00
16 lines
279 B
Bash
Executable File
16 lines
279 B
Bash
Executable File
#!/bin/sh
|
|
# wait-for-postgres.sh
|
|
|
|
set -e
|
|
|
|
host="$1"
|
|
shift
|
|
cmd="$@"
|
|
|
|
until PGUSER=$POSTGRES_USER PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -c '\q'; do
|
|
>&2 echo "Postgres is unavailable - sleeping"
|
|
sleep 1
|
|
done
|
|
|
|
>&2 echo "Postgres is up - executing command"
|
|
exec $cmd |