nk20-scripts/shell/backup_db

10 lines
359 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
2020-09-08 11:16:03 +00:00
# Create temporary backups directory
mkdir -p /tmp/note-backups
date=$(date +%Y-%m-%d)
# Backup database and save it as tar archive
sudo -u postgres pg_dump -F t note_db > "/tmp/note-backups/$date.sql"
# Compress backup as gzip
gzip "/tmp/note-backups/$date.sql"
scp "/tmp/note-backups/$date.sql.gz" "club-bde@zamok.crans.org:backup/$date.sql.gz"