From 3ffd4cdbf86ce1c70eeacf1404ca81df2fa6399c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:33:26 -0300 Subject: ~/.local/bin/backup: Clean up script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove "borg check" and "borg prune" steps; - stop sourcing ~/.bash_profile; - ignore return code 1 from "borg create" command, as detailed in the documentation [0]: > warning (operation reached its normal end, but there > were warnings – you should check the log, logged as WARNING) [0]: https://borgbackup.readthedocs.io/en/stable/usage/general.html --- .local/bin/backup | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 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" \ - ~/ ||: - -borg check \ - --verbose - -borg prune \ - --verbose \ - --list \ - --keep-within=6m \ - --keep-weekly=52 \ - --keep-monthly=24 +run() { + borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache/ \ + --exclude ~/Downloads/ \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ + STATUS=$? + + if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then + echo 'WARNING, but no ERROR.' >&2 + return 0 + else + return "$STATUS" + fi +} + +run || exit $? -- cgit v1.3