mirror of
https://github.com/GrapheneOS/matrix.grapheneos.org.git
synced 2024-10-01 04:45:34 -04:00
20 lines
794 B
Bash
Executable File
20 lines
794 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
remote=root@matrix.grapheneos.org
|
|
|
|
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
ssh $remote "rm -rf local-backup"
|
|
ssh $remote "mkdir local-backup"
|
|
|
|
ssh $remote "mkdir local-backup/$timestamp"
|
|
ssh $remote "pg_dumpall -U postgres > local-backup/$timestamp/all_databases.sql"
|
|
ssh $remote "cp -r /etc/matterbridge.toml local-backup/$timestamp/matterbridge.toml"
|
|
ssh $remote "cp -r /etc/synapse local-backup/$timestamp/synapse"
|
|
ssh $remote "cp -r /var/lib/mjolnir local-backup/$timestamp/mjolnir"
|
|
ssh $remote "tar -cC local-backup $timestamp | zstd -9 | age -r \$(cat backup-public-key.txt) -o local-backup/$timestamp.tar.zst.age"
|
|
rsync -v --fsync --preallocate $remote:./local-backup/$timestamp.tar.zst.age backup/
|
|
|
|
ssh $remote "rm -rf local-backup"
|