aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-05-13 14:57:08 -0300
committerEuAndreh <eu@euandre.org>2023-05-13 14:57:08 -0300
commitad1e029311f56eeb0fee619739f598a89732077a (patch)
tree47a6045a76aa774d36b706971262489f4b2a14cc /src
parentsystem.scm: Add kdig(1) (TLS dig) and tcpdump(8) tools (diff)
downloadtoph-ad1e029311f56eeb0fee619739f598a89732077a.tar.gz
toph-ad1e029311f56eeb0fee619739f598a89732077a.tar.xz
backup.sh: Add -x flag
Notes
See CI logs with: git notes --ref=refs/notes/ci-logs show ad1e029311f56eeb0fee619739f598a89732077a git notes --ref=refs/notes/ci-data show ad1e029311f56eeb0fee619739f598a89732077a Exit status: 0 Duration: 21
Diffstat (limited to 'src')
-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