Created
January 14, 2017 07:30
-
-
Save rjdp/742a93b0621d832d36095e3666b9027f to your computer and use it in GitHub Desktop.
dump each db postgres
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
#!/bin/bash | |
echo "PostgreSQL" | |
export PGPASSWORD="postgre password here" | |
DBLIST=`psql -U postgres -d postgres -q -t -c 'SELECT datname from pg_database'` | |
for d in $DBLIST | |
do | |
echo "Dumping $d"; | |
pg_dump -U postgres $d > /path/to/dump/directory/$d.postgres.sql | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment