diff options
| -rwxr-xr-x | .local/bin/backup | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/.local/bin/backup b/.local/bin/backup index d77425c8..cab37dc5 100755 --- a/.local/bin/backup +++ b/.local/bin/backup @@ -1,5 +1,4 @@ #!/bin/sh -. ~/.bash_profile set -eu usage() { @@ -99,8 +98,6 @@ assert_arg() { ARCHIVE_TAG="${1:-}" assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' -set -x - finish() { STATUS=$? @@ -108,21 +105,24 @@ finish() { } trap finish EXIT -borg create \ - $VERBOSE_FLAGS \ - --comment "$COMMENT" \ - --exclude ~/.cache \ - --stats \ - --compression lzma,9 \ - "::{hostname}-{now}-$ARCHIVE_TAG" \ - ~/ ||: +run() { + borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache/ \ + --exclude ~/Downloads/ \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ + STATUS=$? -borg check \ - --verbose + if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then + echo 'WARNING, but no ERROR.' >&2 + return 0 + else + return "$STATUS" + fi +} -borg prune \ - --verbose \ - --list \ - --keep-within=6m \ - --keep-weekly=52 \ - --keep-monthly=24 +run || exit $? |
