From 5481c591d4b12eebda23d12dc09caa56a7727ff2 Mon Sep 17 00:00:00 2001 From: TheMightyV Date: Sat, 8 Jan 2022 12:20:21 +0100 Subject: backup test mode --- server.sh | 10 ++++++++++ serverconf.sh | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/server.sh b/server.sh index d9c06b7..d8caa16 100755 --- a/server.sh +++ b/server.sh @@ -162,9 +162,19 @@ function same_world() { # checking if latest snapshots are the same as the current world function test_backup_integrity() { + if [ $BACKUP_CHECK_MODE = 0 ]; then + log_info "Backup integrity check: skipped" + return 0 + fi + local retcode=0 for backup_dir in ${BACKUP_DIRS[*]} do + if [[ "$backup_dir" == *:* ]] && [ $BACKUP_CHECK_MODE = 1 ]; then + log_info "Skipping check of remote backup at $backup_dir" + continue + fi + local tmpdir=$(mktemp -d); # restore most recent backup to a temporary dir diff --git a/serverconf.sh b/serverconf.sh index c9ef3c8..5531969 100644 --- a/serverconf.sh +++ b/serverconf.sh @@ -37,3 +37,8 @@ BACKUP_DIRS=( "$PWD/.bak/$CUR_YEAR" "user@backupserver:/path/to/backup/$CUR_YEAR # to avoid having to manually type password, borg can run a command that should echo a password #BACKUP_PASSCOMMAND="echo superstrongpassword" #BACKUP_PASSCOMMAND="pass passwordname" + +# 0 - don't check backups after creation +# 1 - check only local backups +# 2 - check local and remote backups (may take a while if world is large and connection is slow) +BACKUP_CHECK_MODE=1 -- cgit v1.2.3