1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2024-12-26 17:32:23 +00:00
nk20-scripts/shell/backup_db
2024-08-10 19:03:29 +02:00

15 lines
308 B
Bash
Executable File

#!/bin/bash
export $(cat .env_borg | xargs)
# Create temporary backups directory
mkdir -p /tmp/note-backups
# Backup database
sudo -u postgres pg_dump -F t note_db > $BACKUP_FILE
# Keep the last 30 backups
borg prune --keep-last 30
# Save backup
borg create --compression lz4 ::backup-{now} $BACKUP_FILE