Update backup script
Remove useless tee, use "mkdir -p" and use .sql.gz.
This commit is contained in:
parent
f580f9b9e9
commit
354a1f845e
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Create temporary backups directory
|
# Create temporary backups directory
|
||||||
[[ -d /tmp/note-backups ]] || mkdir /tmp/note-backups
|
mkdir -p /tmp/note-backups
|
||||||
date=$(date +%Y-%m-%d)
|
date=$(date +%Y-%m-%d)
|
||||||
# Backup database and save it as tar archive
|
# Backup database and save it as tar archive
|
||||||
su postgres -c "pg_dump -F t note_db" | tee "/tmp/note-backups/$date.tar" > /dev/null
|
sudo -u postgres pg_dump -F t note_db > "/tmp/note-backups/$date.sql"
|
||||||
# Compress backup as gzip
|
# Compress backup as gzip
|
||||||
gzip "/tmp/note-backups/$date.tar"
|
gzip "/tmp/note-backups/$date.sql"
|
||||||
scp "/tmp/note-backups/$date.tar.gz" "club-bde@zamok.crans.org:backup/$date.tar.gz"
|
scp "/tmp/note-backups/$date.sql.gz" "club-bde@zamok.crans.org:backup/$date.sql.gz"
|
||||||
|
|
Loading…
Reference in New Issue