Created
June 25, 2018 09:34
-
-
Save Tam/008f91dbf269adceaa3719efa0cfb7a6 to your computer and use it in GitHub Desktop.
Postgres DB remote to local puller
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
#!/bin/bash | |
ssh devski "pg_dump -U postgres -h 127.0.0.1 -w [DB_NAME] | gzip" >> "/Users/[USER_FOLDER]/Downloads/db.sql.gz"; | |
"/Applications/Postgres.app/Contents/Versions/10/bin/dropdb" [DB_NAME]; | |
"/Applications/Postgres.app/Contents/Versions/10/bin/createdb" [DB_NAME]; | |
gunzip -c "/Users/[USER_FOLDER]/Downloads/db.sql.gz" | "/Applications/Postgres.app/Contents/Versions/10/bin/psql" [DB_NAME] -U postgres; | |
rm "/Users/[USER_FOLDER]/Downloads/db.sql.gz"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment