Created
November 17, 2017 10:38
-
-
Save fabienengels/77836ebc3bae81e26a3b25eebdc68fd3 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
fabien@9b ~ » which postgres_launch | |
postgres_launch () { | |
docker run -it --rm --name postgres_$1 -e POSTGRES_USER=$1 -v $HOME/Databases/$1:/var/lib/postgresql/data -p $2:5432 postgres:9.6 | |
} | |
fabien@9b ~ » which postgres_restore | |
postgres_restore () { | |
pg_restore -U $1 -d postgres -j $(grep -c processor /proc/cpuinfo) -O -x -h 127.0.0.1 -p $(postgres_get_port $1) $2 | |
} | |
fabien@9b ~ » which postgres_get_port | |
postgres_get_port () { | |
docker inspect postgres_$1 | jq -M -r '.[0].NetworkSettings.Ports."5432/tcp"[0].HostPort' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment