Created
July 29, 2015 04:32
-
-
Save bhcleek/82b0164f23e8c45fbfd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# postgres container doesn't exist, we'll create and start it | |
echo "Initializing postgres database..." | |
docker run --name api-postgres -P -d postgres:9.3 > /dev/null | |
# wait for postgres to be initialized | |
PIPE=$(mktemp -d -t pipe.XXXXXX) && mkfifo $PIPE/pipe && exec 3<> $PIPE/pipe && rm -rf $PIPE | |
docker logs --tail=1 -f api-postgres 2>&3 & | |
LOG_PID=$! | |
grep -m1 'database system is ready to accept connections' <&3 | |
kill -SIGTERM $LOG_PID | |
exec 3<&- #close our pipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment