Skip to content

Instantly share code, notes, and snippets.

@digitaldreamer
Last active May 8, 2018 18:58
Show Gist options
  • Save digitaldreamer/3c8b9a858481f7132ec022764fdea528 to your computer and use it in GitHub Desktop.
Save digitaldreamer/3c8b9a858481f7132ec022764fdea528 to your computer and use it in GitHub Desktop.
circle wait for db
#!/usr/bin/env bash
TIMEOUT=5
until psql -h $PG_HOST -U $PG_USER -d $PG_DATABASE -c "select 1" > /dev/null 2>&1 || [ $TIMEOUT -eq 0 ]; do
echo "Waiting for postgres server, $((TIMEOUT--)) remaining attempts..."
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment