hezarfen_backend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | #!/usr/bin/env bash |
| 2 | # Dump every database in the hezarfen compose stack to backups/ next to this |
| 3 | # script. pg_dumpall is required (not pg_dump): each school is its own |
| 4 | # postgres database, and a control-only dump would lose them all. |
| 5 | # |
| 6 | # Keeps: backups/hezarfen-<UTC>.sql.gz, mode 0600. |
| 7 | # Cron example (daily 04:20): |
| 8 | # 20 4 * * * $HOME/hezarfen_backend/backup-postgres.sh |
| 9 | # |
| 10 | # Restore (from ~/hezarfen_backend): |
| 11 | # gunzip -c backups/FILE.sql.gz | podman exec -i hezarfen_backend_postgres psql -U hezarfen -d postgres |
| 12 | |
| 13 | |
| 14 | dir="" |
| 15 | |
| 16 | |
| 17 | # POSTGRES_USER lives in the env file beside this script (plain KEY=value |
| 18 | # lines, no quotes/export); default hezarfen. |
| 19 | user="" |
| 20 | user="" |
| 21 | |
| 22 | out="/backups/hezarfen-.sql.gz" |
| 23 | |
| 24 | # pipefail (set above): a failed pg_dumpall must not leave a "good" empty dump. |
| 25 | | |
| 26 |