Created
October 9, 2018 20:48
-
-
Save mkorkmaz/b4784625683b53bef1ac8598b82cb971 to your computer and use it in GitHub Desktop.
Gets postgresql dump file from the server, restores local database and executes a sql file (i.e a script to reset user passwords for testing purposes)
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
# | |
# cron job runs at my-db-server with this configuration | |
# @daily pg_dump -Fc myRemoteDatabase > /var/lib/postgresql/backups/my-remote-database.dump | |
# | |
scp [email protected]:/var/lib/postgresql/backups/my-remote-database.dump ./temp.dump | |
pg_restore -h 127.0.0.1 -p 5432 -U postgres -c -d myLocalDatabase < ./temp.dump | |
psql -h 127.0.0.1 -p 5432 -U postgres -d myLocalDatabase -a -f ./reset-passwords.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment