summaryrefslogtreecommitdiffstats
path: root/backup.sh
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-04-16 11:10:32 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-04-16 11:10:32 +0200
commita941d5f8b45d01dd8e784a380d8ad52a658e748d (patch)
tree663e3596ee1a4c72ebb38294f01e7f2206088879 /backup.sh
parentfd59bb1d5ee46d5275826376112c7371ecf49d3d (diff)
downloadbin-a941d5f8b45d01dd8e784a380d8ad52a658e748d.tar.gz
bin-a941d5f8b45d01dd8e784a380d8ad52a658e748d.tar.xz
backup.sh: disable --progress for cronjobs; add comment
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'backup.sh')
-rwxr-xr-xbackup.sh24
1 files changed, 14 insertions, 10 deletions
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"
}