aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/infrastructure/scripts/backup.sh24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/infrastructure/scripts/backup.sh b/src/infrastructure/scripts/backup.sh
index 83a6cdc..6a2a4ff 100755
--- a/src/infrastructure/scripts/backup.sh
+++ b/src/infrastructure/scripts/backup.sh
@@ -4,7 +4,7 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- backup [-q] [-C COMMENT] [ARCHIVE_TAG]
+ backup [-q] [-C COMMENT] [-x] [ARCHIVE_TAG]
backup -h
EOF
}
@@ -16,6 +16,7 @@ help() {
Options:
-q disable verbose mode, useful for batch sessions
-C COMMENT the comment text to be attached to the archive
+ -x disable checking the repository after creating the backup
-h, --help show this message
ARCHIVE_TAG the tag used to create the new
@@ -43,12 +44,18 @@ help() {
Run backup from cronjob:
+ $ backup
+
+
+ Run backup from cronjob:
+
$ backup -q cronjob
- Create backup with a comment, a tag, and verbose mode active:
+ Create backup with a comment, a tag, and verbose mode active, and do not
+ verify the repository afterwards:
- $ backup -C 'The backup has a comment'
+ $ backup -xC 'The backup has a comment'
EOF
}
@@ -70,7 +77,8 @@ done
VERBOSE_FLAGS='--verbose --progress'
COMMENT=' '
-while getopts 'qC:h' flag; do
+CHECK=true
+while getopts 'qC:xh' flag; do
case "$flag" in
q)
VERBOSE_FLAGS=''
@@ -78,6 +86,9 @@ while getopts 'qC:h' flag; do
C)
COMMENT="$OPTARG"
;;
+ x)
+ CHECK=false
+ ;;
h)
usage
help
@@ -132,4 +143,7 @@ run() {
run
-sudo -i borg check --verify-data --verbose "$BORG_REPO"
+if [ "$CHECK" = true ]; then
+ # shellcheck disable=2086
+ sudo -i borg check $VERBOSE_FLAGS --verify-data "$BORG_REPO"
+fi