Skip to content

Instantly share code, notes, and snippets.

@glebov21
Created August 19, 2019 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glebov21/24ed94e082109da49122e2e8fe071970 to your computer and use it in GitHub Desktop.
Save glebov21/24ed94e082109da49122e2e8fe071970 to your computer and use it in GitHub Desktop.
restore postgresql backup
#!/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