restic.sh (686B)
1 #!/bin/bash 2 3 set -o pipefail 4 5 mkdir -p ~/logs 6 7 # have to do this because cron 8 source ~/.bashrc 9 10 # to init remote: 11 # uses RESTIC_PASSWORD env var 12 # restic -r sftp:root@andrew-1.selfhost.imbue.com:/backup/ init 13 14 # I could set the env var for the repo path, but that would limit to one location of backups... 15 16 # This is executed by cron 17 18 restic -vv -r sftp:root@andrew-1.selfhost.imbue.com:/backup/ backup /home/backup $HOME/personal-files | tee -a ~/logs/backup-restic.log 2>&1 19 20 # TODO: This isn't great; we don't have pipefail -e set... 21 echo "$(date)" >> $HOME/logs/backup-restic-times.txt 22 23 # restic -r sftp:root@andrew-1.selfhost.imbue.com:/backup/ -r restore latest --target /restored