matrix.grapheneos.org/local-backup

20 lines
794 B
Plaintext
Raw Permalink Normal View History

2022-07-22 00:40:20 -04:00
#!/bin/bash
set -o errexit -o nounset -o pipefail
remote=root@matrix.grapheneos.org
2022-08-11 18:17:24 -04:00
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
2022-07-22 00:40:20 -04:00
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"
2022-08-11 13:05:24 -04:00
ssh $remote "cp -r /etc/synapse local-backup/$timestamp/synapse"
2023-11-04 15:12:45 -04:00
ssh $remote "cp -r /var/lib/mjolnir local-backup/$timestamp/mjolnir"
2022-08-07 08:01:42 -04:00
ssh $remote "tar -cC local-backup $timestamp | zstd -9 | age -r \$(cat backup-public-key.txt) -o local-backup/$timestamp.tar.zst.age"
2023-07-26 04:46:39 -04:00
rsync -v --fsync --preallocate $remote:./local-backup/$timestamp.tar.zst.age backup/
ssh $remote "rm -rf local-backup"