From 75855654381cdab32d299dbeb0cb8807a5aef4ed Mon Sep 17 00:00:00 2001 From: "Jonas W. Carson" Date: Tue, 3 Jan 2017 13:52:07 -0500 Subject: [PATCH 1/4] remove symlinks from backup, added logic to start that covers an issue when starting a restored backup world --- msctl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/msctl b/msctl index db45388..c71e164 100755 --- a/msctl +++ b/msctl @@ -1037,7 +1037,11 @@ start() { # -original directory within we didn't stop cleanly. if [ -d "WORLDS_LOCATION/$1/$1-original" ]; then # Remove the symlink to the world-file mirror image. - rm -r "$WORLDS_LOCATION/$1/$1" + # if recently restored from backup, this symlink may or may not exist + if [ -L "$WORLDS_LOCATION/$1/$1" ]; then + rm -r "$WORLDS_LOCATION/$1/$1" + fi + # Move the world files back to their original path name. mv "$WORLDS_LOCATION/$1/$1-original" "$WORLDS_LOCATION/$1/$1" fi @@ -1130,8 +1134,13 @@ worldBackup() { echo "Error creating backup dir $BACKUP_LOCATION" return 1 fi + # Synchronize the mirror image of the world prior to closing, if + # required. + if [ $ENABLE_MIRROR -eq 1 ] && [ -d $MIRROR_PATH ]; then + syncMirrorImage $1 + fi # Create the backup. - if ! $RDIFF_BACKUP -v5 --print-statistics "$WORLDS_LOCATION/$1" "$BACKUP_LOCATION/$1" >> "$BACKUP_LOG"; then + if ! $RDIFF_BACKUP -v5 --print-statistics --exclude-symbolic-links "$WORLDS_LOCATION/$1" "$BACKUP_LOCATION/$1" >> "$BACKUP_LOG"; then echo "Error doing backup of world $1" return 1 fi From 1187835b4ef06dd03e3b72852f423820ed4ca2f7 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 6 Jan 2017 16:40:01 -0500 Subject: [PATCH 2/4] adjust exclude option to only look at the mirrored symlink --- msctl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/msctl b/msctl index 112156a..4a73084 100755 --- a/msctl +++ b/msctl @@ -1129,6 +1129,7 @@ forceStop() { # @return A 0 if backup successful, a 1 otherwise # --------------------------------------------------------------------------- worldBackup() { + local EXCLUDE_OPTION # Make sure that the backup location exists. if ! mkdir -p "$BACKUP_LOCATION"; then echo "Error creating backup dir $BACKUP_LOCATION" @@ -1139,8 +1140,12 @@ worldBackup() { if [ $ENABLE_MIRROR -eq 1 ] && [ -d $MIRROR_PATH ]; then syncMirrorImage $1 fi + # Determine if we need to exclude the mirrored symlink or not + if [ -L "$WORLDS_LOCATION/$1/$1" ]; then + EXCLUDE_OPTION="--exclude $WORLDS_LOCATION/$1/$1" + fi # Create the backup. - if ! $RDIFF_BACKUP -v5 --print-statistics --exclude-symbolic-links "$WORLDS_LOCATION/$1" "$BACKUP_LOCATION/$1" >> "$BACKUP_LOG"; then + if ! $RDIFF_BACKUP -v5 --print-statistics $EXCLUDE_OPTION "$WORLDS_LOCATION/$1" "$BACKUP_LOCATION/$1" >> "$BACKUP_LOG"; then echo "Error doing backup of world $1" return 1 fi @@ -1154,6 +1159,7 @@ worldBackup() { return 0 } + # --------------------------------------------------------------------------- # List the backups for the world server. # From 1c1a5292a5085b4a0a6bd540bd027c77ce8dd4e2 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 6 Jan 2017 16:43:50 -0500 Subject: [PATCH 3/4] check for sync resources directly instead of $MIRROR_PATH --- msctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msctl b/msctl index 4a73084..1e14958 100755 --- a/msctl +++ b/msctl @@ -1098,7 +1098,7 @@ stop() { sendCommand $1 "end" # Synchronize the mirror image of the world prior to closing, if # required. - if [ $ENABLE_MIRROR -eq 1 ] && [ -d $MIRROR_PATH ]; then + if [ $ENABLE_MIRROR -eq 1 ] && [ -L "$WORLDS_LOCATION/$1" ] && [ -d $WORLDS_LOCATION/$1/$1-original ]; then syncMirrorImage $1 # Remove the symlink to the world-file mirror image. rm -r "$WORLDS_LOCATION/$1/$1" @@ -1137,7 +1137,7 @@ worldBackup() { fi # Synchronize the mirror image of the world prior to closing, if # required. - if [ $ENABLE_MIRROR -eq 1 ] && [ -d $MIRROR_PATH ]; then + if [ $ENABLE_MIRROR -eq 1 ] && [ -L "$WORLDS_LOCATION/$1" ] && [ -d $WORLDS_LOCATION/$1/$1-original ]; then syncMirrorImage $1 fi # Determine if we need to exclude the mirrored symlink or not From 0599a32eb924ed848e7082574ca77444c81cd0f6 Mon Sep 17 00:00:00 2001 From: "Jason M. Wood" Date: Sat, 7 Jan 2017 16:09:35 -0700 Subject: [PATCH 4/4] msctl: remove extra whitespace --- msctl | 1 - 1 file changed, 1 deletion(-) diff --git a/msctl b/msctl index 1e14958..e710b04 100755 --- a/msctl +++ b/msctl @@ -1159,7 +1159,6 @@ worldBackup() { return 0 } - # --------------------------------------------------------------------------- # List the backups for the world server. #