Feedati/docker/wait-db

13 lines
305 B
Text
Raw Normal View History

#!/bin/bash
timeout=60
for _ in $(seq 1 "$timeout"); do
if env PGPASSWORD=password-dev psql -h db -U ttrss -w ttrss -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