steam_crawl/wait-for-db.sh
2025-09-12 22:47:41 +02:00

16 lines
278 B
Bash
Executable File

#!/bin/sh
# wait-for-db.sh
set -e
host="$1"
shift
cmd="$@"
until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c '\q'; do
echo "Waiting for database at $host..."
sleep 2
done
echo "Database is ready, executing command..."
exec $cmd