14 lines
368 B
Bash
Executable file
14 lines
368 B
Bash
Executable file
#!/bin/bash
|
|
### psql configuration parameters must be received as environ vars
|
|
### (PGHOST, PGDATABASE, PGUSER, PGPASSWORD)
|
|
timeout=60
|
|
for _ in $(seq 1 "$timeout"); do
|
|
if psql -w -c "" -q 2> /dev/null; then
|
|
echo "DB ready"
|
|
exec "$@"
|
|
fi
|
|
echo "Waiting..." >&2
|
|
sleep 1
|
|
done
|
|
echo "Timeout! postgresql wasn't ready in 60 seconds" >&2
|
|
exit 1
|