From a941d5f8b45d01dd8e784a380d8ad52a658e748d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 16 Apr 2016 11:10:32 +0200 Subject: backup.sh: disable --progress for cronjobs; add comment Signed-off-by: Florian Pritz --- backup.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'backup.sh') diff --git a/backup.sh b/backup.sh index 4208db1..e6d4ad0 100755 --- a/backup.sh +++ b/backup.sh @@ -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" } -- cgit v1.2.3-24-g4f1b