🍪 1 min read

mount -t davfs https://webdav.magentacloud.de /mnt/magenta

umount /mnt/magenta

fstab:

webdav.magentacloud.de

https://webdav.magentacloud.de /mnt/magenta davfs noauto,user,rw 0 0

mount /mnt/magenta

sudo apt install borgbackup

borg init –encryption=repokey-blake2 /mnt/magenta/c1o_backup

#!/bin/sh

mount /mnt/magenta

REPOSITORY=/mnt/magenta/c1o_backup

#Bail if borg is already running, maybe previous run didn’t finish if pidof -x borg >/dev/null; then echo “Backup already running” exit fi

Setting this, so you won’t be asked for your repository passphrase:

export BORG_PASSPHRASE=‘QfVcnSkBueX3Y$m7F&p5pJ4v’

or this to ask an external program to supply the passphrase:

export BORG_PASSCOMMAND=‘pass show backup’

Backup all of /home and /var/www except a few

excluded directories

borg create -v –stats
$REPOSITORY::‘{hostname}-{now:%Y-%m-%d}’
/home/dennis/bw/bwdate

Use the prune subcommand to maintain 7 daily, 4 weekly and 6 monthly

archives of THIS machine. The ‘{hostname}-’ prefix is very important to

limit prune’s operation to this machine’s archives and not apply to

other machine’s archives also.

borg prune -v –list $REPOSITORY –prefix ‘{hostname}-’
–keep-daily=7 –keep-weekly=4 –keep-monthly=6

umount /mnt/magenta

chmod +x borg_bu.sh

crontab -e 0 0 * * * /home/dennis/borg_bu.sh > /home/dennis/backup_log.txt 2>&1