TechDocs/OfficeBackUp/Script

Script for Office Backups

This script makes backing up data semi-automatically quite simple, following the Office Backup guide.

Save the script

  1. Save the code below (in the gre box) to a directory of your choice, for example as a new file called borg_backup.sh in a directory bin inside of your home directory.

  2. Open the directory, in which you created this file, with your terminal. Now execute chmod +x borg_backup.sh to make the file executable.

Configure the script

Now, open the file in a plain text editor and change some parts:

#!/bin/sh

# Destination for borg repository
export BORG_REPO=ssh://FSFEUSER@fsfe-backup.fritz.box:22/~/Borg

# Which files/directories shall be backupped? Separate with spaces
BACKUP="$HOME"

# command to get borg password from, in this case from within `pass`
export BORG_PASSCOMMAND='pass show borg_backup'

# Actual backup command
# If you need to exclude more directories, copy and amend `--exclude` line
borg create --verbose --stats --progress \
            --one-file-system --compression lz4 --exclude-caches \
            --exclude $HOME/.cache    \
            ::'{hostname}-{now}'      \
            ${BACKUP}


borg prune -v --list            \
              --keep-within=1d  \
              --keep-daily=7    \
              --keep-weekly=4   \
              --keep-monthly=12 \
              --prefix '{hostname}-'

TechDocs/OfficeBackUp/Script (last edited 2019-02-12 13:48:27 by max.mehl)