diff options
-rwxr-xr-x | backup.sh | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -21,7 +21,8 @@ main() { TMPDIR="$(mktemp -d "/tmp/${0##*/}.XXXXXX")" trap "rm -rf '${TMPDIR}'" EXIT TERM - # these mountpoints will be excluded + # these mountpoints will be excluded. mountpoints not listed in either this + # or the includeMountpoints variable below will throw an error excludeMountpoints=( /tmp /sys @@ -74,16 +75,19 @@ EOF backup_borg() { local src=$1 local dst=$2 + local -a options=( + --verbose + --numeric-owner + --compression lz4 + --stats + --exclude-from "$TMPDIR/exclude-list-borg" + ) + + if tty -s; then + options+=(--progress) + fi - borg create \ - -v \ - --numeric-owner \ - --compression lz4 \ - --stats \ - --progress \ - --exclude-from "$TMPDIR/exclude-list-borg" \ - "$dst::backup-$(date "+%Y%m%d-%H%M%S")" "$src" - + borg create "${options[@]}" "$dst::backup-$(date "+%Y%m%d-%H%M%S")" "$src" borg prune -v --keep-within 6m "$dst" } |