Created
August 19, 2019 10:28
-
-
Save glebov21/24ed94e082109da49122e2e8fe071970 to your computer and use it in GitHub Desktop.
restore postgresql backup
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 | |
backupfile="pgsql_2019-08-06.sql.gz" | |
cd /data/pgbackup | |
gunzip -c ${backupfile} > restore.sql | |
systemctl stop aero | |
service postgresql restart | |
su postgres -c 'dropdb aerodb' | |
su postgres -c $'psql -f /data/pgbackup/restore.sql postgres' | |
systemctl restart aero | |
rm restore.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment