1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2025-02-06 07:13:01 +00:00
nk20-scripts/shell/backup_db

15 lines
308 B
Plaintext
Raw Normal View History

#!/bin/bash
2024-08-10 19:03:29 +02:00
export $(cat .env_borg | xargs)
2020-09-08 13:16:03 +02:00
# Create temporary backups directory
mkdir -p /tmp/note-backups
2024-08-10 19:03:29 +02:00
# 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