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 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 to make the file executable.

Configure the script

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


# Destination for borg repository
export BORG_REPO=ssh://

# Which files/directories shall be backupped? Separate with spaces

# 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}'      \

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)