mirror of
https://gitlab.crans.org/bde/nk20-scripts
synced 2024-12-25 00:42:23 +00:00
354a1f845e
Remove useless tee, use "mkdir -p" and use .sql.gz.
10 lines
359 B
Bash
Executable File
10 lines
359 B
Bash
Executable File
#!/bin/bash
|
|
# 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"
|