Created
July 11, 2016 13:42
-
-
Save stormsilver/e12e0353c54167ce45626a5186776d68 to your computer and use it in GitHub Desktop.
Scripts for backing up + reloading a postgres data dir
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 | |
stopgres | |
mkdir -p ~/.postgres | |
sudo rm -rf ~/.postgres/databackup | |
sudo cp -r /Library/PostgreSQL/9.4/data ~/.postgres/databackup | |
startgres |
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 | |
stopgres | |
sudo rm -rf /Library/PostgreSQL/9.4/data | |
sudo cp -r ~/.postgres/databackup /Library/PostgreSQL/9.4/data | |
sudo chown -R postgres /Library/PostgreSQL/9.4/data | |
startgres |
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 | |
sudo -u postgres /Library/PostgreSQL/9.4/bin/pg_ctl -D /Library/PostgreSQL/9.4/data -w start | |
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 | |
sudo -u postgres /Library/PostgreSQL/9.4/bin/pg_ctl -D /Library/PostgreSQL/9.4/data -m fast stop | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment