Created
April 13, 2019 09:06
-
-
Save setomits/e3816dae4720948dc909eccacd2a6943 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function startpg | |
if test -z (docker ps --filter name=mypostgresql --quiet) | |
echo "Start PostgreSQL container" | |
docker run --rm --detach --publish 15432:5432 \ | |
--name mypostgresql \ | |
--volume (pwd)/db:/var/lib/postgresql/data \ | |
postgres | |
echo -n "Starting PostfreSQL process " | |
while test -z $PG_READY | |
set PG_READY (psql --host localhost --port 15432 \ | |
--username postgres \ | |
--tuples-only --no-align \ | |
--command 'select 1;' ^ /dev/null) | |
echo -n "." | |
sleep 1 | |
end | |
echo | |
echo "PostgreSQL started" | |
echo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment