serhii.net

In the middle of the desert you can say anything you want

UNLISTED

31 May 2022

Backup concept

Decided to improve my existing mess of systems that do this and document it all while I’m at it.

Borg script for yunohost

#!/bin/bash
rm /home/yunohost.backup/archives/full*
rm -rf /home/admin/backups/yhf
yunohost backup create -n full -o /home/admin/backups/yhf

set -eu
export BORG_REMOTE_PATH=borg1
export BORG_REPO="my@bo.rg:borg/repo"
export BORG_PASSPHRASE='My borg passphrase'

/usr/bin/borg create ::$(hostname)-$(date "+%m%d-%H%M%S") /home/admin/backups/yhf
/usr/bin/borg prune ::$(hostname)-$(date "+%m%d-%H%M%S") --keep-daily=14 --keep-monthly=6

It’s inside /etc/cron.daily/, so gets run at least once a day.

borg list :: would list all backups available in that (remote) repo.

If only the repo is set, that command would first ask for the ssh password (unless id_rsa is available) and then for the borg decryption password.

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus