aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar TheMightyV <themightyv@protonmail.com> 2022-01-08 12:20:21 +0100
committerGravatar TheMightyV <themightyv@protonmail.com> 2022-01-08 12:20:21 +0100
commit5481c591d4b12eebda23d12dc09caa56a7727ff2 (patch)
tree8e55efe50f9abdc23eb505fe7793b9fdc725d059
parent3257c178d20dff95bdb6177cd8ad6b85204e0165 (diff)
downloadminecraft-server-tools-5481c591d4b12eebda23d12dc09caa56a7727ff2.tar.gz
backup test mode
-rwxr-xr-xserver.sh10
-rw-r--r--serverconf.sh5
2 files changed, 15 insertions, 0 deletions
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