0x90-pyinfra/files/matrix-synapse/borgbackup.sh

21 lines
615 B
Bash

#!/bin/ksh
. /etc/borg-env
export BORG_REPO=nathan@nephilim:repositories-borg/matrix
export BORG_RSH="ssh \
-o TCPKeepAlive=no \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=10 \
-o Compression=no"
# copy synapse data so that we don't rely on our slow downlink
nice -n 19 /usr/local/bin/rsync -a --delete /var/synapse/ /var/synapse-backup/
rcctl stop synapse
date
/usr/local/bin/rsync -a --delete /var/synapse/ /var/synapse-backup/
sync
date
rdate time.cloudflare.com
rcctl start synapse
nice -n 19 /usr/local/bin/borg create --stats ::'backup{now:%Y%m%d-%H%M}' /var/synapse-backup /var/postgresql /etc