Backup and Restore scripts

This commit is contained in:
gw3000 2023-07-30 13:31:13 +02:00
parent ac6a8515b7
commit c0b0ce8874
3 changed files with 24 additions and 0 deletions

16
bin/restoreDB Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# STOP WEB CONTAINER TO KILL ALL SESSIONS.
docker stop django_fbf-web-1
# DROP THE DATABASE.
docker exec -it django_fbf-db-1 psql -U fbf -d postgres -c "DROP DATABASE db_fbf;"
# CREATE THE DATABASE.
docker exec -it django_fbf-db-1 psql -U fbf -d postgres -c "CREATE DATABASE db_fbf;"
# RESTORE THE DATABASE.
docker exec -it django_fbf-db-1 /usr/local/bin/psql -U fbf -d db_fbf -f /backup/fbf-backup.sql
# START THE WEB CONTAINER.
docker start django_fbf-web-1