diff options
| -rw-r--r-- | borgAuto.sh | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/borgAuto.sh b/borgAuto.sh index 29b6c24..e7192ad 100644 --- a/borgAuto.sh +++ b/borgAuto.sh @@ -1,22 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/bash +# 8 Sept 2019 SJ Pratt # Copied from https://blog.andrewkeech.com/posts/170718_borg.html # the envvar $REPONAME is something you should just hardcode -export REPOSITORY="/media/$USER/$REPONAME/borg/" +export REPOSITORY="/mnt/bak/borg" # Fill in your password here, borg picks it up automatically export BORG_PASSPHRASE="" # Backup all of /home except a few excluded directories and files borg create -v --stats --compression lz4 \ - $REPOSITORY::'{hostname}-{now:%Y-%m-%d %H:%M}' /home \ + $REPOSITORY::'{hostname}-{now:%Y-%m-%dT%H:%M}' /home \ --exclude '/home/*/.cache' \ ---exclude '/home/*/.ccache' \ ---exclude '/home/$USER/.local/include' \ ---exclude '/home/$USER/.local/installppa.sh' \ ---exclude '/home/$USER/.local/listppa' \ ---exclude '/home/$USER/Downloads' \ ---exclude '/home/$USER/VirtualBox\ VMs' \ ---exclude '/home/$USER/lxd-zfs.img' \ +--exclude '/home/$USER/cargo' \ --exclude '/home/lost+found' \ --exclude '*.img' \ --exclude '*.iso' \ @@ -24,11 +19,6 @@ borg create -v --stats --compression lz4 \ # Route the normal process logging to journalctl 2>&1 -# If there is an error backing up, reset password envvar and exit -if [ "$?" = "1" ] ; then - export BORG_PASSPHRASE="" - exit 1 -fi # Prune the repo of extra backups borg prune -v $REPOSITORY --prefix '{hostname}-' \ @@ -38,10 +28,8 @@ borg prune -v $REPOSITORY --prefix '{hostname}-' \ --keep-monthly=6 \ # Include the remaining device capacity in the log -df -hl | grep --color=never /dev/sdc +df -hl | grep --color=never /mnt/bak borg list $REPOSITORY -# Unset the password -export BORG_PASSPHRASE="" exit 0 |
