From 8316d878531c35f2f96d6e1697ae21944916aaa5 Mon Sep 17 00:00:00 2001
From: Daniel Gibbs <me@danielgibbs.co.uk>
Date: Sun, 12 Jul 2020 23:16:22 +0100
Subject: [PATCH] fix(log): allow logs to correctly display primary command
 (#2958)

---
 lgsm/functions/alert.sh                       |   1 +
 lgsm/functions/check_last_update.sh           |   1 +
 lgsm/functions/check_steamcmd.sh              |   2 +-
 lgsm/functions/check_version.sh               |   1 +
 lgsm/functions/command_backup.sh              |  38 +-
 lgsm/functions/command_console.sh             |  10 +-
 lgsm/functions/command_debug.sh               |  10 +-
 lgsm/functions/command_details.sh             |   9 +-
 lgsm/functions/command_dev_clear_functions.sh |   9 +-
 lgsm/functions/command_dev_debug.sh           |   9 +-
 lgsm/functions/command_dev_detect_deps.sh     |   9 +-
 lgsm/functions/command_dev_detect_glibc.sh    |   9 +-
 lgsm/functions/command_dev_detect_ldd.sh      |   9 +-
 lgsm/functions/command_dev_query_raw.sh       |   9 +-
 lgsm/functions/command_donate.sh              |   9 +-
 lgsm/functions/command_fastdl.sh              |  31 +-
 lgsm/functions/command_install.sh             |  10 +-
 .../command_install_resources_mta.sh          |   9 +-
 lgsm/functions/command_mods_install.sh        |   9 +-
 lgsm/functions/command_mods_remove.sh         |  18 +-
 lgsm/functions/command_mods_update.sh         |   9 +-
 lgsm/functions/command_monitor.sh             |  10 +-
 lgsm/functions/command_postdetails.sh         |   9 +-
 lgsm/functions/command_restart.sh             |  11 +-
 lgsm/functions/command_start.sh               |  12 +-
 lgsm/functions/command_stop.sh                |   9 +-
 lgsm/functions/command_test_alert.sh          |   9 +-
 lgsm/functions/command_ts3_server_pass.sh     |  13 +-
 lgsm/functions/command_update.sh              |   9 +-
 lgsm/functions/command_update_linuxgsm.sh     |   9 +-
 lgsm/functions/command_validate.sh            |  39 +-
 lgsm/functions/command_wipe.sh                | 339 +++++++++---------
 lgsm/functions/compress_unreal2_maps.sh       |   9 +-
 lgsm/functions/compress_ut99_maps.sh          |   9 +-
 lgsm/functions/core_dl.sh                     |   6 +-
 lgsm/functions/fix_kf.sh                      |   4 +
 lgsm/functions/fix_kf2.sh                     |   2 +
 lgsm/functions/fix_ro.sh                      |   4 +
 lgsm/functions/fix_ut2k4.sh                   |   4 +
 lgsm/functions/fix_ut3.sh                     |   2 +
 lgsm/functions/fix_wurm.sh                    |   2 +
 lgsm/functions/info_messages.sh               |   4 +-
 lgsm/functions/install_modules.sh             |   1 +
 lgsm/functions/mods_core.sh                   |  16 +-
 lgsm/functions/update_factorio.sh             |  12 +-
 lgsm/functions/update_minecraft.sh            |  13 +-
 lgsm/functions/update_minecraft_bedrock.sh    |  14 +-
 lgsm/functions/update_mta.sh                  |  12 +-
 lgsm/functions/update_mumble.sh               |  11 +-
 lgsm/functions/update_steamcmd.sh             |  11 +-
 lgsm/functions/update_ts3.sh                  |   4 +
 linuxgsm.sh                                   |   2 +-
 tests/tests_fctrserver.sh                     |   6 +-
 tests/tests_jc2server.sh                      |   6 +-
 tests/tests_mcserver.sh                       |   6 +-
 tests/tests_ts3server.sh                      |   6 +-
 56 files changed, 504 insertions(+), 352 deletions(-)

diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh
index 5f8fe156e..236ca6461 100644
--- a/lgsm/functions/alert.sh
+++ b/lgsm/functions/alert.sh
@@ -99,6 +99,7 @@ fn_alert_log
 if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
 	exitbypass=1
 	command_postdetails.sh
+	fn_commandname
 elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
 	fn_print_warn_nl "More Info not enabled"
 	fn_script_log_warn "More Info alerts not enabled"
diff --git a/lgsm/functions/check_last_update.sh b/lgsm/functions/check_last_update.sh
index 52e4cfce0..08343e560 100644
--- a/lgsm/functions/check_last_update.sh
+++ b/lgsm/functions/check_last_update.sh
@@ -20,5 +20,6 @@ if [ -f "${lockdir}/lastupdate.lock" ]&&[ "${status}" != "0" ]; then
 		fn_print_info "${selfname} has not been restarted since last update"
 		fn_script_log_info "${selfname} has not been restarted since last update"
 		command_restart.sh
+		fn_commandname
 	fi
 fi
diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh
index aa4140bbe..456870054 100644
--- a/lgsm/functions/check_steamcmd.sh
+++ b/lgsm/functions/check_steamcmd.sh
@@ -130,7 +130,7 @@ fn_check_steamcmd_clear(){
 if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then
 	rm -rf "${steamcmddir:?}"
 	exitcode=$?
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_script_log_fatal "Removing ${rootdir}/steamcmd"
 	else
 		fn_script_log_pass "Removing ${rootdir}/steamcmd"
diff --git a/lgsm/functions/check_version.sh b/lgsm/functions/check_version.sh
index 6db78091d..a0b0bc50c 100644
--- a/lgsm/functions/check_version.sh
+++ b/lgsm/functions/check_version.sh
@@ -16,4 +16,5 @@ if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modules
 	fn_sleep_time
 	fn_script_log_error "LinuxGSM Version mismatch: ${selfname}: ${version}: modules: ${modulesversion}"
 	command_update_linuxgsm.sh
+	fn_commandname
 fi
diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh
index 537e86f1c..7d62e965b 100644
--- a/lgsm/functions/command_backup.sh
+++ b/lgsm/functions/command_backup.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Creates a .tar.gz file in the backup directory.
 
-commandname="BACKUP"
-commandaction="Backing up"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="BACKUP"
+	commandaction="Backing up"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 
@@ -61,22 +64,20 @@ fn_backup_init(){
 # Check if server is started and whether to stop it.
 fn_backup_stop_server(){
 	check_status.sh
-	# Server is stopped.
-	if [ "${status}" == "0" ]; then
-		serverstopped="no"
-	# Server is running and stoponbackup=off.
-	elif [ "${stoponbackup}" == "off" ]; then
-		serverstopped="no"
+	# Server is running but will not be stopped.
+	if [ "${stoponbackup}" == "off" ]; then
 		fn_print_warn_nl "${selfname} is currently running"
 		echo -e "* Although unlikely; creating a backup while ${selfname} is running might corrupt the backup."
 		fn_script_log_warn "${selfname} is currently running"
 		fn_script_log_warn "Although unlikely; creating a backup while ${selfname} is running might corrupt the backup"
 	# Server is running and will be stopped if stoponbackup=on or unset.
-	else
+	# If server is started
+	elif [ "${status}" != "0" ]; then
 		fn_stop_warning
-		serverstopped="yes"
+		startserver="1"
 		exitbypass=1
 		command_stop.sh
+		fn_commandname
 	fi
 }
 
@@ -140,7 +141,7 @@ fn_backup_compression(){
 
 	tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./.
 	local exitcode=$?
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_print_fail_eol
 		fn_script_log_fatal "Backup in progress: FAIL"
 		echo -e "${extractcmd}" | tee -a "${lgsmlog}"
@@ -247,25 +248,26 @@ fn_backup_relpath() {
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
+	fn_print_warn "this game server will be stopped during backup"
+	fn_script_log_warn "this game server will be stopped during backup"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during backup: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during backup"
+	fn_print_warn_nl "this game server will be stopped during backup"
 }
 
-# Restart the server if it was stopped for the backup.
+# Start the server if it was stopped for the backup.
 fn_backup_start_server(){
-	if [ "${serverstopped}" == "yes" ]; then
+	if [ -n "${startserver}" ]; then
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 	fi
 }
 
diff --git a/lgsm/functions/command_console.sh b/lgsm/functions/command_console.sh
index 18e674652..02040d5c5 100644
--- a/lgsm/functions/command_console.sh
+++ b/lgsm/functions/command_console.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Gives access to the server tmux console.
 
-commandname="CONSOLE"
-commandaction="Access console"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="CONSOLE"
+	commandaction="Access console"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 fn_print_header
@@ -35,6 +38,7 @@ else
 	if fn_prompt_yn "Do you want to start the server?" Y; then
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 	fi
 fi
 
diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh
index 5aeb0d5e1..4addb86b5 100644
--- a/lgsm/functions/command_debug.sh
+++ b/lgsm/functions/command_debug.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Runs the server without tmux and directly from the terminal.
 
-commandname="DEBUG"
-commandaction="Debuging"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEBUG"
+	commandaction="Debuging"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 # Trap to remove lockfile on quit.
 fn_lockfile_trap(){
@@ -88,6 +91,7 @@ fn_print_info_nl "Stopping any running servers"
 fn_script_log_info "Stopping any running servers"
 exitbypass=1
 command_stop.sh
+fn_commandname
 unset exitbypass
 fn_print_dots "Starting debug"
 fn_script_log_info "Starting debug"
diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh
index c2abc0ba0..b90f8a6f5 100644
--- a/lgsm/functions/command_details.sh
+++ b/lgsm/functions/command_details.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Displays server information.
 
-commandname="DETAILS"
-commandaction="Viewing details"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DETAILS"
+	commandaction="Viewing details"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 # Run checks and gathers details to display.
 check.sh
diff --git a/lgsm/functions/command_dev_clear_functions.sh b/lgsm/functions/command_dev_clear_functions.sh
index 0c2faa375..935ebb4ef 100644
--- a/lgsm/functions/command_dev_clear_functions.sh
+++ b/lgsm/functions/command_dev_clear_functions.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Deletes the contents of the functions dir.
 
-commandname="DEV-CLEAR-MODULES"
-commandaction="Clearing modules"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-CLEAR-MODULES"
+	commandaction="Clearing modules"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 echo -e "================================="
 echo -e "Clear Functions"
diff --git a/lgsm/functions/command_dev_debug.sh b/lgsm/functions/command_dev_debug.sh
index 962b01e7f..4a076df9e 100644
--- a/lgsm/functions/command_dev_debug.sh
+++ b/lgsm/functions/command_dev_debug.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Dev only: Enables debugging log to be saved to dev-debug.log.
 
-commandname="DEV-DEBUG"
-commandaction="Developer debug"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-DEBUG"
+	commandaction="Developer debug"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 if [ -f "${rootdir}/.dev-debug" ]; then
 	rm "${rootdir:?}/.dev-debug"
diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh
index 04f37d696..089aa9af3 100644
--- a/lgsm/functions/command_dev_detect_deps.sh
+++ b/lgsm/functions/command_dev_detect_deps.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Detects dependencies the server binary requires.
 
-commandname="DEV-DETECT-DEPS"
-commandaction="Developer detect deps"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-DETECT-DEPS"
+	commandaction="Developer detect deps"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 echo -e "================================="
 echo -e "Dependencies Checker"
diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh
index 2289bb818..c2feae0c9 100644
--- a/lgsm/functions/command_dev_detect_glibc.sh
+++ b/lgsm/functions/command_dev_detect_glibc.sh
@@ -5,9 +5,12 @@
 # Description: Automatically detects the version of GLIBC that is required.
 # Can check a file or directory recursively.
 
-commandname="DEV-DETECT-GLIBC"
-commandaction="Developer detect glibc"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-DETECT-GLIBC"
+	commandaction="Developer detect glibc"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 echo -e "================================="
 echo -e "glibc Requirements Checker"
diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh
index 850845179..60766cce5 100644
--- a/lgsm/functions/command_dev_detect_ldd.sh
+++ b/lgsm/functions/command_dev_detect_ldd.sh
@@ -5,9 +5,12 @@
 # Description: Automatically detects required deps using ldd.
 # Can check a file or directory recursively.
 
-commandname="DEV-DETECT-LDD"
-commandaction="Developer detect ldd"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-DETECT-LDD"
+	commandaction="Developer detect ldd"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 echo -e "================================="
 echo -e "Shared Object dependencies Checker"
diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh
index 22ed232ec..00005c22c 100644
--- a/lgsm/functions/command_dev_query_raw.sh
+++ b/lgsm/functions/command_dev_query_raw.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Raw gamedig output of the server.
 
-commandname="DEV-QUERY-RAW"
-commandaction="Developer query raw"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEV-QUERY-RAW"
+	commandaction="Developer query raw"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 info_config.sh
diff --git a/lgsm/functions/command_donate.sh b/lgsm/functions/command_donate.sh
index 9bb7f2faf..0483e4aa1 100644
--- a/lgsm/functions/command_donate.sh
+++ b/lgsm/functions/command_donate.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Shows ways to donate.
 
-commandname="DONATE"
-commandaction="Donate"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+  commandname="DONATE"
+  commandaction="Donate"
+  functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_print_ascii_logo
 echo -e "${lightyellow}Support LinuxGSM${default}"
diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh
index f6a5897db..a4d06d5e6 100644
--- a/lgsm/functions/command_fastdl.sh
+++ b/lgsm/functions/command_fastdl.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Creates a FastDL directory.
 
-commandname="FASTDL"
-commandaction="Fastdl"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="FASTDL"
+	commandaction="Fastdl"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 
@@ -69,7 +72,7 @@ fn_clear_old_fastdl(){
 		echo -en "clearing existing FastDL directory ${fastdldir}..."
 		rm -fR "${fastdldir:?}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Clearing existing FastDL directory ${fastdldir}"
 			core_exit.sh
@@ -86,7 +89,7 @@ fn_fastdl_dirs(){
 		echo -en "creating web directory ${webdir}..."
 		mkdir -p "${webdir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating web directory ${webdir}"
 			core_exit.sh
@@ -99,7 +102,7 @@ fn_fastdl_dirs(){
 		echo -en "creating fastdl directory ${fastdldir}..."
 		mkdir -p "${fastdldir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating fastdl directory ${fastdldir}"
 			core_exit.sh
@@ -245,7 +248,7 @@ fn_fastdl_gmod(){
 			echo -e "copying ${allowed_extention} : ${fileswc}..."
 			cp --parents "${fastdlfile}" "${fastdldir}"
 			exitcode=$?
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				fn_print_fail_eol_nl
 				fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}"
 				core_exit.sh
@@ -262,7 +265,7 @@ fn_fastdl_gmod(){
 		echo -en "updating addons file structure..."
 		cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Updating addons file structure"
 			core_exit.sh
@@ -275,7 +278,7 @@ fn_fastdl_gmod(){
 		fn_sleep_time
 		rm -fR "${fastdldir:?}/addons"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Clearing addons dir from fastdl dir"
 			core_exit.sh
@@ -290,7 +293,7 @@ fn_fastdl_gmod(){
 		fn_sleep_time
 		cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Correcting DarkRP files"
 			core_exit.sh
@@ -342,7 +345,7 @@ fn_fastdl_source(){
 					fi
 					cp "${fastdlfile}" "${fastdldir}/${copytodir}"
 					exitcode=$?
-					if [ ${exitcode} -ne 0 ]; then
+					if [ "${exitcode}" != 0 ]; then
 						fn_print_fail_eol_nl
 						fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}/${copytodir}"
 						core_exit.sh
@@ -378,7 +381,7 @@ fn_fastdl_gmod_dl_enforcer(){
 		echo -en "removing existing download enforcer: ${luafastdlfile}..."
 		rm -f "${luafastdlfullpath:?}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Removing existing download enforcer ${luafastdlfullpath}"
 			core_exit.sh
@@ -396,7 +399,7 @@ fn_fastdl_gmod_dl_enforcer(){
 			echo -e "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}"
 		done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n')
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating new download enforcer ${luafastdlfullpath}"
 			core_exit.sh
@@ -413,7 +416,7 @@ fn_fastdl_bzip2(){
 		echo -en "\r\033[Kcompressing ${filetocompress}..."
 		bzip2 -f "${filetocompress}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Compressing ${filetocompress}"
 			core_exit.sh
diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh
index 9a6b64e98..23fdd3179 100644
--- a/lgsm/functions/command_install.sh
+++ b/lgsm/functions/command_install.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Overall function for the installer.
 
-commandname="INSTALL"
-commandaction="Installing"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="INSTALL"
+	commandaction="Installing"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 if [ "$(whoami)" = "root" ]; then
@@ -42,6 +45,7 @@ else
 		install_ts3db.sh
 	elif [ "${shortname}" == "mta" ]; then
 		command_install_resources_mta.sh
+		fn_commandname
 	fi
 
 	fix.sh
diff --git a/lgsm/functions/command_install_resources_mta.sh b/lgsm/functions/command_install_resources_mta.sh
index 053982e0b..4c641dcef 100644
--- a/lgsm/functions/command_install_resources_mta.sh
+++ b/lgsm/functions/command_install_resources_mta.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Installs the default resources for Multi Theft Auto.
 
-commandname="DEFAULT-RESOURCES"
-commandaction="Default Resources"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="DEFAULT-RESOURCES"
+	commandaction="Default Resources"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_install_resources(){
 	echo -e ""
diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/functions/command_mods_install.sh
index d3c517461..48bf116b3 100644
--- a/lgsm/functions/command_mods_install.sh
+++ b/lgsm/functions/command_mods_install.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: List and installs available mods along with mods_list.sh and mods_core.sh.
 
-commandname="MODS-INSTALL"
-commandaction="Installing mods"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MODS-INSTALL"
+	commandaction="Installing mods"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 mods_core.sh
diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh
index 35fd41d5f..b2062333e 100644
--- a/lgsm/functions/command_mods_remove.sh
+++ b/lgsm/functions/command_mods_remove.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Uninstall mods along with mods_list.sh and mods_core.sh.
 
-commandname="MODS-REMOVE"
-commandaction="Removing mods"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MODS-REMOVE"
+	commandaction="Removing mods"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 mods_core.sh
@@ -70,7 +73,7 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 	if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
 		rm -rf "${modinstalldir:?}/${currentfileremove:?}"
 		((exitcode=$?))
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}"
 			break
 		else
@@ -81,7 +84,7 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 	echo -e "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..."
 	((modfileline++))
 done
-if [ ${exitcode} -ne 0 ]; then
+if [ "${exitcode}" != 0 ]; then
 	fn_print_fail_eol_nl
 	core_exit.sh
 else
@@ -92,7 +95,7 @@ echo -en "removing ${modcommand}-files.txt..."
 fn_sleep_time
 rm -rf "${modsdir:?}/${modcommand}-files.txt"
 local exitcode=$?
-if [ ${exitcode} -ne 0 ]; then
+if [ "${exitcode}" != 0 ]; then
 	fn_script_log_fatal "Removing ${modsdir}/${modcommand}-files.txt"
 	fn_print_fail_eol_nl
 	core_exit.sh
@@ -107,7 +110,7 @@ fn_sleep_time
 
 sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}"
 local exitcode=$?
-if [ ${exitcode} -ne 0 ]; then
+if [ "${exitcode}" != 0 ]; then
 	fn_script_log_fatal "Removing ${modcommand} from ${modsinstalledlist}"
 	fn_print_fail_eol_nl
 	core_exit.sh
@@ -123,6 +126,7 @@ if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then
 	fn_script_log "Validating to restore original ${gamename} files replaced by Oxide"
 	exitbypass="1"
 	command_validate.sh
+	fn_commandname
 	unset exitbypass
 fi
 echo -e "${modprettyname} removed"
diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh
index 165b4ea98..d6cd15e70 100644
--- a/lgsm/functions/command_mods_update.sh
+++ b/lgsm/functions/command_mods_update.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Updates installed mods along with mods_list.sh and mods_core.sh.
 
-commandname="MODS-UPDATE"
-commandaction="Updating mods"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MODS-UPDATE"
+	commandaction="Updating mods"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 mods_core.sh
diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh
index 691fd5f7c..adc2be363 100644
--- a/lgsm/functions/command_monitor.sh
+++ b/lgsm/functions/command_monitor.sh
@@ -6,9 +6,12 @@
 # Description: Monitors server by checking for running processes
 # then passes to gamedig and gsquery.
 
-commandname="MONITOR"
-commandaction="Monitoring"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MONITOR"
+	commandaction="Monitoring"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found.
@@ -170,6 +173,7 @@ for queryattempt in {1..5}; do
 				alert="restartquery"
 				alert.sh
 				command_restart.sh
+				fn_commandname
 				core_exit.sh
 			fi
 		elif [ "${querymethod}" ==  "gamedig" ]; then
diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh
index a0afa2905..0d40b6a0b 100644
--- a/lgsm/functions/command_postdetails.sh
+++ b/lgsm/functions/command_postdetails.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Strips sensitive information out of Details output
 
-commandname="POST-DETAILS"
-commandaction="Posting details"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="POST-DETAILS"
+	commandaction="Posting details"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 # Set posttarget to the appropriately-defined post destination.
 
diff --git a/lgsm/functions/command_restart.sh b/lgsm/functions/command_restart.sh
index 8a08c04ff..47fa163a8 100644
--- a/lgsm/functions/command_restart.sh
+++ b/lgsm/functions/command_restart.sh
@@ -4,13 +4,16 @@
 # Website: https://linuxgsm.com
 # Description: Restarts the server.
 
-commandname="MODS-INSTALL"
-commandaction="Restarting"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+  commandname="MODS-INSTALL"
+  commandaction="Restarting"
+  functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 info_config.sh
 exitbypass=1
 command_stop.sh
 command_start.sh
-
+fn_commandname
 core_exit.sh
diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh
index d0487e5d4..c78bcc158 100644
--- a/lgsm/functions/command_start.sh
+++ b/lgsm/functions/command_start.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Starts the server.
 
-commandname="START"
-commandaction="Starting"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="START"
+	commandaction="Starting"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_start_teamspeak3(){
 	if [ ! -f "${servercfgfullpath}" ]; then
@@ -188,8 +191,7 @@ if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateon
 	exitbypass=1
 	unset updateonstart
 	command_update.sh
-	commandname="START"
-	commandaction="Starting"
+	fn_commandname
 fi
 
 fn_print_dots "${servername}"
diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh
index 6ea4f4d7a..085f9996a 100644
--- a/lgsm/functions/command_stop.sh
+++ b/lgsm/functions/command_stop.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Stops the server.
 
-commandname="STOP"
-commandaction="Stopping"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="STOP"
+	commandaction="Stopping"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 # Attempts graceful shutdown by sending 'CTRL+c'.
 fn_stop_graceful_ctrlc(){
diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/functions/command_test_alert.sh
index 5d1c11885..969c648ca 100644
--- a/lgsm/functions/command_test_alert.sh
+++ b/lgsm/functions/command_test_alert.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Sends a test alert.
 
-commandname="TEST-ALERT"
-commandaction="Sending Alert"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+  commandname="TEST-ALERT"
+  commandaction="Sending Alert"
+  functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_print_dots "${servername}"
 check.sh
diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh
index 8ff799e6e..ba25747cc 100644
--- a/lgsm/functions/command_ts3_server_pass.sh
+++ b/lgsm/functions/command_ts3_server_pass.sh
@@ -5,9 +5,12 @@
 # Website: https://linuxgsm.com
 # Description: Changes TS3 serveradmin password.
 
-commandname="CHANGE-PASSWORD"
-commandaction="Changing password"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="CHANGE-PASSWORD"
+	commandaction="Changing password"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_serveradmin_password_prompt(){
 	fn_print_header
@@ -28,6 +31,7 @@ fn_serveradmin_password_set(){
 	ts3serverpass="1"
 	exitbypass="1"
 	command_start.sh
+	fn_commandname
 	fn_print_ok_nl "New password applied"
 	fn_script_log_pass "New ServerAdmin password applied"
 }
@@ -39,13 +43,16 @@ if [ "${status}" != "0" ]; then
 	# Stop any running server.
 	exitbypass="1"
 	command_stop.sh
+	fn_commandname
 	fn_serveradmin_password_set
 	parms="serveradmin_password=\"${newpassword}\" inifile=\"${servercfgfullpath}\" > /dev/null 2>&1"
 	ts3serverpass="0"
 	command_restart.sh
+	fn_commandname
 else
 	fn_serveradmin_password_set
 	command_stop.sh
+	fn_commandname
 fi
 
 core_exit.sh
diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh
index 88109a147..b6254937a 100644
--- a/lgsm/functions/command_update.sh
+++ b/lgsm/functions/command_update.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Handles updating of servers.
 
-commandname="UPDATE"
-commandaction="Updating"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="UPDATE"
+	commandaction="Updating"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_print_dots ""
 check.sh
diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh
index c32bf321f..e4028cf18 100644
--- a/lgsm/functions/command_update_linuxgsm.sh
+++ b/lgsm/functions/command_update_linuxgsm.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
 
-commandname="UPDATE-LGSM"
-commandaction="Updating LinuxGSM"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="UPDATE-LGSM"
+	commandaction="Updating LinuxGSM"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 
diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh
index 276458e48..a00fb99ce 100644
--- a/lgsm/functions/command_validate.sh
+++ b/lgsm/functions/command_validate.sh
@@ -4,23 +4,26 @@
 # Website: https://linuxgsm.com
 # Description: Runs a server validation.
 
-commandname="VALIDATE"
-commandaction="Validating"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="VALIDATE"
+	commandaction="Validating"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 fn_validate(){
-	fn_script_log_warn "Validating server: SteamCMD: Validate might overwrite some customised files"
+	fn_script_log_warn "SteamCMD: Validate might overwrite some customised files"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Validating server: SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
+		fn_print_warn "SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Validating server: SteamCMD: Validate might overwrite some customised files"
-	fn_print_start_nl "Validating server: SteamCMD"
+	fn_print_warn_nl "SteamCMD: Validate might overwrite some customised files"
+	fn_print_start_nl "SteamCMD"
 	fn_script_log_info "Validating server: SteamCMD"
 	if [ -d "${steamcmddir}" ]; then
 		cd "${steamcmddir}" || exit
@@ -40,8 +43,7 @@ fn_validate(){
 			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
 		fi
 	elif [ "${shortname}" == "ac" ]; then
-		${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit
-		local exitcode=$?
+		${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
 	# All other servers.
 	elif [ -n "${branch}" ]; then
 		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
@@ -50,42 +52,43 @@ fn_validate(){
 	fi
 
 	exitcode=$?
-	fn_print_dots "Validating server: SteamCMD"
+	fn_print_dots "SteamCMD"
 	if [ "${exitcode}" != "0" ]; then
-		fn_print_fail_nl "Validating server: SteamCMD"
+		fn_print_fail_nl "SteamCMD"
 		fn_script_log_fatal "Validating server: SteamCMD: FAIL"
 	else
-		fn_print_ok_nl "Validating server: SteamCMD"
+		fn_print_ok_nl "SteamCMD"
 		fn_script_log_pass "Validating server: SteamCMD: OK"
 	fi
 	core_exit.sh
 }
 
 fn_stop_warning(){
-	fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
-	fn_script_log_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
+	fn_print_warn "this game server will be stopped during validate"
+	fn_script_log_warn "this game server will be stopped during validate"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during validate: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Validating server: SteamCMD: ${selfname} will be stopped during validation"
+	fn_print_warn_nl "this game server will be stopped during validate"
 }
 
-fn_print_dots "Validating server"
-fn_print_dots "Validating server: SteamCMD"
+fn_print_dots "SteamCMD"
 check.sh
 if [ "${status}" != "0" ]; then
 	fn_stop_warning
 	exitbypass=1
 	command_stop.sh
+	fn_commandname
 	fn_validate
 	exitbypass=1
 	command_start.sh
+	fn_commandname
 else
 	fn_validate
 fi
diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh
index 5b5abf552..96e10a98f 100644
--- a/lgsm/functions/command_wipe.sh
+++ b/lgsm/functions/command_wipe.sh
@@ -5,34 +5,17 @@
 # Website: https://linuxgsm.com
 # Description: Wipes server data, useful after updates for some games like Rust
 
-commandname="WIPE"
-commandaction="Wiping"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-
-check.sh
-fn_print_header
-fn_script_log "Entering ${gamename} ${commandaction}"
-
-# Process to server wipe.
-fn_wipe_server_process(){
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		exitbypass=1
-		command_stop.sh
-		fn_wipe_server_remove_files
-		exitbypass=1
-		command_start.sh
-	else
-		fn_wipe_server_remove_files
-	fi
-	echo -e "server data wiped"
-	fn_script_log "server data wiped."
+fn_commandname(){
+	commandname="WIPE"
+	commandaction="Wiping"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 }
+fn_commandname
 
 # Provides an exit code upon error.
 fn_wipe_exit_code(){
 	((exitcode=$?))
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_script_log_fatal "${currentaction}"
 		core_exit.sh
 	else
@@ -41,166 +24,190 @@ fn_wipe_exit_code(){
 }
 
 # Removes files to wipe server.
-fn_wipe_server_remove_files(){
-	# Rust Wipe.
-	if [ "${shortname}" == "rust" ]; then
-		# Wipe pocedural map.
-		if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
-			currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.map"
-			echo -en "Removing procedural map proceduralmap.*.map file(s)..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete
-			fn_wipe_exit_code
-			fn_sleep_time
-		else
-			fn_print_information_nl "No procedural map file to remove"
-			fn_script_log_info "No procedural map file to remove."
-		fi
-		# Wipe procedural map save.
-		if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
-			currentaction="Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
-			echo -en "Removing map saves proceduralmap.*.sav file(s)..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete
-			fn_wipe_exit_code
-			fn_sleep_time
-		else
-			fn_print_information_nl "No procedural map save to remove"
-			fn_script_log_info "No procedural map save to remove."
-		fi
-		# Wipe Barren map.
-		if [ "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
-			currentaction="Removing map file(s): ${serveridentitydir}/barren*.map"
-			echo -en "Removing barren map barren*.map file(s)..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "barren*.map" -delete
-			fn_wipe_exit_code
-			fn_sleep_time
-		else
-			fn_print_information_nl "No barren map file to remove"
-			fn_script_log_info "No barren map file to remove."
-		fi
-		# Wipe barren map save.
-		if [ "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
-			currentaction="Removing barren map save(s): ${serveridentitydir}/barren*.sav"
-			echo -en "Removing barren map saves barren*.sav file(s)..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "barren*.sav" -delete
-			fn_wipe_exit_code
-			fn_sleep_time
-		else
-			fn_print_information_nl "No barren map save to remove"
-			fn_script_log_info "No barren map save to remove."
-		fi
-		# Wipe user dir, might be a legacy thing, maybe to be removed.
-		if [ -d "${serveridentitydir}/user" ]; then
-			currentaction="Removing user directory: ${serveridentitydir}/user"
-			echo -en "Removing user directory..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			rm -rf "${serveridentitydir:?}/user"
-			fn_wipe_exit_code
-			fn_sleep_time
+fn_wipe_server_files(){
+	fn_print_start_nl "Wiping server"
+	fn_script_log_info "Wiping server"
+	# Wipe procedural map.
+	if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
+		echo -en "removing procedural map proceduralmap.*.map file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing procedural map file(s): ${serveridentitydir}/proceduralmap.*.map"
+		find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
+	else
+		echo -e "no procedural map file to remove"
+		fn_sleep_time
+		fn_script_log_pass "No procedural map file to remove"
+	fi
+	# Wipe procedural map save.
+	if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
+		echo -en "removing map saves proceduralmap.*.sav file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
+		find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
+	else
+		echo -e "no procedural map save to remove"
+		fn_sleep_time
+		fn_script_log_pass "No procedural map save to remove"
+	fi
+	# Wipe Barren map.
+	if [ "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
+		echo -en "removing barren map barren*.map file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing map file(s): ${serveridentitydir}/barren*.map"
+		find "${serveridentitydir:?}" -type f -name "barren*.map" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
+	else
+		echo -e "no barren map file to remove"
+		fn_sleep_time
+		fn_script_log_pass "No barren map file to remove"
+	fi
+	# Wipe barren map save.
+	if [ "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
+		echo -en "removing barren map saves barren*.sav file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing barren map save(s): ${serveridentitydir}/barren*.sav"
+		find "${serveridentitydir:?}" -type f -name "barren*.sav" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
+	else
+		echo -e "no barren map save to remove"
+		fn_sleep_time
+		fn_script_log_pass "No barren map save to remove."
+	fi
+	# Wipe user dir, might be a legacy thing, maybe to be removed.
+	if [ -d "${serveridentitydir}/user" ]; then
+		echo -en "removing user directory..."
+		fn_sleep_time
+		fn_script_log_info "removing user directory: ${serveridentitydir}/user"
+		rm -rf "${serveridentitydir:?}/user"
+		fn_wipe_exit_code
+		fn_sleep_time
 		# We do not print additional information if there is nothing to remove since this might be obsolete.
-		fi
-		# Wipe storage dir, might be a legacy thing, maybe to be removed.
-		if [ -d "${serveridentitydir}/storage" ]; then
-			currentaction="Removing storage directory: ${serveridentitydir}/storage"
-			echo -en "Removing storage directory..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			rm -rf "${serveridentitydir:?}/storage"
-			fn_wipe_exit_code
-			fn_sleep_time
+	fi
+	# Wipe storage dir, might be a legacy thing, maybe to be removed.
+	if [ -d "${serveridentitydir}/storage" ]; then
+		echo -en "removing storage directory..."
+		fn_sleep_time
+		fn_script_log_info "removing storage directory: ${serveridentitydir}/storage"
+		rm -rf "${serveridentitydir:?}/storage"
+		fn_wipe_exit_code
+		fn_sleep_time
 		# We do not print additional information if there is nothing to remove since this might be obsolete.
-		fi
-		# Wipe sv.files.
-		if [ "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
-			currentaction="Removing server misc files: ${serveridentitydir}/sv.files.*.db"
-			echo -en "Removing server misc srv.files*.db file(s)..."
-			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "sv.files.*.db" -delete
-			fn_wipe_exit_code
-			fn_sleep_time
+	fi
+	# Wipe sv.files.
+	if [ "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
+		echo -en "removing server misc srv.files*.db file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing server misc files: ${serveridentitydir}/sv.files.*.db"
+		find "${serveridentitydir:?}" -type f -name "sv.files.*.db" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
 		# No further information if not found because it should I could not get this file showing up.
-		fi
-		# Wipe player death files.
-		if [ "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
-			currentaction="Removing player death files: ${serveridentitydir}/player.deaths.*.db"
-			echo -en "Removing player deaths player.deaths.*.db file(s)..."
+	fi
+	# Wipe player death files.
+	if [ "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
+		echo -en "removing player deaths player.deaths.*.db file(s)..."
+		fn_sleep_time
+		fn_script_log_info "Removing player death files: ${serveridentitydir}/player.deaths.*.db"
+		find "${serveridentitydir:?}" -type f -name "player.deaths.*.db" -delete | tee -a "${lgsmlog}"
+		fn_wipe_exit_code
+		fn_sleep_time
+	else
+		echo -e "no player death to remove"
+		fn_sleep_time
+		fn_script_log_pass "No player death to remove"
+	fi
+	# Wipe blueprints only if full-wipe command was used.
+	if [ "${fullwipe}" == "1" ]; then
+		if [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
+			echo -en "removing blueprints player.blueprints.*.db file(s)..."
 			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "player.deaths.*.db" -delete
+			fn_script_log_info "Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db"
+			find "${serveridentitydir:?}" -type f -name "player.blueprints.*.db" -delete | tee -a "${lgsmlog}"
 			fn_wipe_exit_code
 			fn_sleep_time
 		else
-			fn_print_information_nl "No player death to remove"
-			fn_script_log_info "No player death to remove."
-		fi
-		# Wipe blueprints only if wipeall command was used.
-		if [ "${wipeall}" == "1" ]; then
-			if [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
-				currentaction="Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db"
-				echo -en "Removing blueprints player.blueprints.*.db file(s)..."
-				fn_sleep_time
-				fn_script_log "${currentaction}"
-				find "${serveridentitydir:?}" -type f -name "player.blueprints.*.db" -delete
-				fn_wipe_exit_code
-				fn_sleep_time
-			else
-				fn_print_information_nl "No blueprint file to remove"
-				fn_script_log_info "No blueprint file to remove."
-			fi
-		elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
-				fn_print_information_nl "Keeping blueprints"
-				fn_script_log_info "Keeping blueprints."
-		else
-				fn_print_information_nl "No blueprints found"
-				fn_script_log_info "No blueprints found."
-				fn_sleep_time
+			echo -e "no blueprint file to remove"
+			fn_sleep_time
+			fn_script_log_pass "No blueprint file to remove"
 		fi
-		# Wipe some logs that might be there.
-		if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
-			currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
-			echo -en "Removing Log files..."
+	elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
+			echo -e "keeping blueprints"
 			fn_sleep_time
-			fn_script_log "${currentaction}"
-			find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
-			fn_wipe_exit_code
+			fn_script_log_info "Keeping blueprints"
+	else
+			echo -e "no blueprints found"
 			fn_sleep_time
+			fn_script_log_pass "No blueprints found"
+	fi
+	# Wipe some logs that might be there.
+	if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
+		echo -en "removing Log files..."
+		fn_sleep_time
+		fn_script_log_info "Removing log files: ${serveridentitydir}/Log.*.txt"
+		find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
+		fn_wipe_exit_code
+		fn_sleep_time
 		# We do not print additional information if there are no logs to remove.
-		fi
-	# You can add an "elif" here to add another game or engine.
 	fi
 }
 
-# Check if there is something to wipe, prompt the user, and call appropriate functions.
-# Rust Wipe.
-if [ "${shortname}" == "rust" ]; then
-	if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
-		fn_print_warning_nl "Any user, storage, log and map data from ${serveridentitydir} will be erased."
-		if ! fn_prompt_yn "Continue?" Y; then
-				core_exit.sh
+fn_stop_warning(){
+	fn_print_warn "this game server will be stopped during wipe"
+	fn_script_log_warn "this game server will be stopped during wipe"
+	totalseconds=3
+	for seconds in {3..1}; do
+		fn_print_warn "this game server will be stopped during wipe: ${totalseconds}"
+		totalseconds=$((totalseconds - 1))
+		sleep 1
+		if [ "${seconds}" == "0" ]; then
+			break
 		fi
-		fn_script_log_info "User selects to erase any user, storage, log and map data from ${serveridentitydir}"
-		fn_sleep_time
-		fn_wipe_server_process
+	done
+	fn_print_warn_nl "this game server will be stopped during wipe"
+}
+
+fn_wipe_warning(){
+	fn_print_warn "wipe is about to start"
+	fn_script_log_warn "wipe is about to start"
+	totalseconds=3
+	for seconds in {3..1}; do
+		fn_print_warn "wipe is about to start: ${totalseconds}"
+		totalseconds=$((totalseconds - 1))
+		sleep 1
+		if [ "${seconds}" == "0" ]; then
+			break
+		fi
+	done
+	fn_print_warn "wipe is about to start"
+}
+
+fn_print_dots ""
+check.sh
+
+# Check if there is something to wipe.
+if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
+	fn_wipe_warning
+	check_status.sh
+	if [ "${status}" != "0" ]; then
+		fn_stop_warning
+		exitbypass=1
+		command_stop.sh
+		fn_commandname
+		fn_wipe_server_files
+		exitbypass=1
+		command_start.sh
+		fn_commandname
 	else
-		fn_print_information_nl "No data to wipe was found"
-		fn_script_log_info "No data to wipe was found."
-		core_exit.sh
+		fn_wipe_server_files
 	fi
-# You can add an "elif" here to add another game or engine.
-else
-	# Game not listed.
-	fn_print_information_nl "Wipe is not available for this game"
-	fn_script_log_info "Wipe is not available for this game."
-	core_exit.sh
+	fn_print_ok_nl ""
+	fn_script_log_pass "Wiping server"
 fi
 
 core_exit.sh
diff --git a/lgsm/functions/compress_unreal2_maps.sh b/lgsm/functions/compress_unreal2_maps.sh
index 3580c20c9..e08dd666f 100644
--- a/lgsm/functions/compress_unreal2_maps.sh
+++ b/lgsm/functions/compress_unreal2_maps.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Compresses unreal maps.
 
-commandname="MAP-COMPRESSOR"
-commandaction="Compressing maps"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MAP-COMPRESSOR"
+	commandaction="Compressing maps"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 fn_print_header
diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh
index 677f5aaa2..e475c466b 100644
--- a/lgsm/functions/compress_ut99_maps.sh
+++ b/lgsm/functions/compress_ut99_maps.sh
@@ -4,9 +4,12 @@
 # Website: https://linuxgsm.com
 # Description: Compresses unreal maps.
 
-commandname="MAP-COMPRESSOR"
-commandaction="Compressing maps"
-functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+fn_commandname(){
+	commandname="MAP-COMPRESSOR"
+	commandaction="Compressing maps"
+	functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+}
+fn_commandname
 
 check.sh
 fn_print_header
diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh
index 89ee784db..514eb3da8 100644
--- a/lgsm/functions/core_dl.sh
+++ b/lgsm/functions/core_dl.sh
@@ -25,7 +25,7 @@ fn_clear_tmp(){
 	if [ -d "${tmpdir}" ]; then
 		rm -rf "${tmpdir:?}/"*
 		local exitcode=$?
-		if [ ${exitcode} -eq 0 ]; then
+		if [ "${exitcode}" == 0 ]; then
 			fn_print_ok_eol_nl
 			fn_script_log_pass "clearing LinuxGSM tmp directory"
 		else
@@ -82,7 +82,7 @@ fn_dl_extract(){
 		extractcmd=$(unzip -qo -d "${extractdir}" "${local_filedir}/${local_filename}")
 	fi
 	local exitcode=$?
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_print_fail_eol_nl
 		fn_script_log_fatal "Extracting download"
 		if [ -f "${lgsmlog}" ]; then
@@ -171,7 +171,7 @@ fn_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					fn_print_fail_eol_nl
 					if [ -f "${lgsmlog}" ]; then
diff --git a/lgsm/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh
index f0c29ee6f..a745094b0 100644
--- a/lgsm/functions/fix_kf.sh
+++ b/lgsm/functions/fix_kf.sh
@@ -21,11 +21,15 @@ echo -e "forcing server restart..."
 fn_sleep_time
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
diff --git a/lgsm/functions/fix_kf2.sh b/lgsm/functions/fix_kf2.sh
index 77edd77e8..99e96543a 100644
--- a/lgsm/functions/fix_kf2.sh
+++ b/lgsm/functions/fix_kf2.sh
@@ -14,6 +14,8 @@ fn_print_information "starting ${gamename} server to generate configs."
 fn_sleep_time
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 10
 exitbypass=1
 command_stop.sh
+fn_commandname
diff --git a/lgsm/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh
index 9f08d56d7..902fed7fe 100644
--- a/lgsm/functions/fix_ro.sh
+++ b/lgsm/functions/fix_ro.sh
@@ -24,11 +24,15 @@ echo -e "forcing server restart..."
 fn_sleep_time
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
diff --git a/lgsm/functions/fix_ut2k4.sh b/lgsm/functions/fix_ut2k4.sh
index fa2d29bf5..07805d42b 100644
--- a/lgsm/functions/fix_ut2k4.sh
+++ b/lgsm/functions/fix_ut2k4.sh
@@ -21,11 +21,15 @@ echo -e "forcing server restart."
 fn_sleep_time
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 5
 exitbypass=1
 command_stop.sh
+fn_commandname
diff --git a/lgsm/functions/fix_ut3.sh b/lgsm/functions/fix_ut3.sh
index e6c018d00..ad9b3db4e 100644
--- a/lgsm/functions/fix_ut3.sh
+++ b/lgsm/functions/fix_ut3.sh
@@ -14,6 +14,8 @@ fn_print_information "starting ${gamename} server to generate configs."
 fn_sleep_time
 exitbypass=1
 command_start.sh
+fn_commandname
 sleep 10
 exitbypass=1
 command_stop.sh
+fn_commandname
diff --git a/lgsm/functions/fix_wurm.sh b/lgsm/functions/fix_wurm.sh
index 809651d55..40325d729 100644
--- a/lgsm/functions/fix_wurm.sh
+++ b/lgsm/functions/fix_wurm.sh
@@ -18,8 +18,10 @@ if [ ! -d "${serverfiles}/Creative" ]; then
 	fixbypass=1
 	exitbypass=1
 	command_start.sh
+	fn_commandname
 	sleep 10
 	exitbypass=1
 	command_stop.sh
+	fn_commandname
 	unset parmsbypass
 fi
diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh
index 843dc26a1..d423e0f4a 100644
--- a/lgsm/functions/info_messages.sh
+++ b/lgsm/functions/info_messages.sh
@@ -135,7 +135,7 @@ fn_info_message_gameserver_resource(){
 	echo -e "${lightyellow}Game Server Resource Usage${default}"
 	fn_messages_separator
 	{
-		if [ "${status}" == "1" ]; then
+		if [ "${status}" != "0" ]; then
 			echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
 			echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}"
 		else
@@ -1515,7 +1515,7 @@ fn_info_message_select_engine(){
 	elif [ "${shortname}" == "bf1942" ]; then
 		fn_info_message_bf1942
 	elif [ "${shortname}" == "bfv" ]; then
-		fn_info_message_bfv	
+		fn_info_message_bfv
 	elif [ "${shortname}" == "rtcw" ]; then
 		fn_info_message_rtcw
 	elif [ "${shortname}" == "rust" ]; then
diff --git a/lgsm/functions/install_modules.sh b/lgsm/functions/install_modules.sh
index c512b69a3..39729fd23 100644
--- a/lgsm/functions/install_modules.sh
+++ b/lgsm/functions/install_modules.sh
@@ -14,3 +14,4 @@ cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.sh "${functionsdir}"
 cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.py "${functionsdir}"
 chmod +x "${functionsdir}"/*
 command_update_linuxgsm.sh
+fn_commandname
diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh
index da2576207..bd6b6275c 100644
--- a/lgsm/functions/mods_core.sh
+++ b/lgsm/functions/mods_core.sh
@@ -53,7 +53,7 @@ fn_mod_lowercase(){
 		done < <(find "${extractdir}" -depth)
 		echo -en "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..."
 
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			core_exit.sh
 		else
@@ -69,7 +69,7 @@ fn_mod_create_filelist(){
 	# ${modsdir}/${modcommand}-files.txt.
 	find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
 	local exitcode=$?
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_print_fail_eol_nl
 		fn_script_log_fatal "Building ${modsdir}/${modcommand}-files.txt"
 		core_exit.sh
@@ -89,7 +89,7 @@ fn_mod_copy_destination(){
 	fn_sleep_time
 	cp -Rf "${extractdir}/." "${modinstalldir}/"
 	local exitcode=$?
-	if [ ${exitcode} -ne 0 ]; then
+	if [ "${exitcode}" != 0 ]; then
 		fn_print_fail_eol_nl
 		fn_script_log_fatal "Copying ${modprettyname} to ${modinstalldir}"
 	else
@@ -127,7 +127,7 @@ fn_mod_tidy_files_list(){
 		sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
 		# Exit on error.
 		local exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Error while tidying line: ${removefilevar} from: ${modsdir}/${modcommand}-files.txt"
 			core_exit.sh
@@ -382,7 +382,7 @@ fn_create_mods_dir(){
 		echo -en "creating LinuxGSM mods data directory ${modsdir}..."
 		mkdir -p "${modsdir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating mod download dir ${modsdir}"
 			core_exit.sh
@@ -396,7 +396,7 @@ fn_create_mods_dir(){
 		echo -en "creating mods install directory ${modinstalldir}..."
 		mkdir -p "${modinstalldir}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating mod install directory ${modinstalldir}"
 			core_exit.sh
@@ -419,7 +419,7 @@ fn_mods_create_tmp_dir(){
 		mkdir -p "${modstmpdir}"
 		exitcode=$?
 		echo -en "creating mod download directory ${modstmpdir}..."
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Creating mod download directory ${modstmpdir}"
 			core_exit.sh
@@ -436,7 +436,7 @@ fn_mods_clear_tmp_dir(){
 		echo -en "clearing mod download directory ${modstmpdir}..."
 		rm -fr "${modstmpdir:?}"
 		exitcode=$?
-		if [ ${exitcode} -ne 0 ]; then
+		if [ "${exitcode}" != 0 ]; then
 			fn_print_fail_eol_nl
 			fn_script_log_fatal "Clearing mod download directory ${modstmpdir}"
 			core_exit.sh
diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh
index 5ff67c448..869314d60 100644
--- a/lgsm/functions/update_factorio.sh
+++ b/lgsm/functions/update_factorio.sh
@@ -96,17 +96,21 @@ fn_update_factorio_compare(){
 			fn_update_factorio_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_factorio_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -131,18 +135,18 @@ fn_update_factorio_compare(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh
index 556097bd6..62cf6a80c 100644
--- a/lgsm/functions/update_minecraft.sh
+++ b/lgsm/functions/update_minecraft.sh
@@ -44,8 +44,10 @@ fn_update_minecraft_localbuild(){
 		fn_script_log_info "Forcing server restart"
 		exitbypass=1
 		command_stop.sh
+		fn_commandname
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 		totalseconds=0
 		# Check again, allow time to generate logs.
 		while [ ! -f "${serverfiles}/logs/latest.log" ]; do
@@ -157,15 +159,18 @@ fn_update_minecraft_compare(){
 			command_start.sh
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_minecraft_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -190,18 +195,18 @@ fn_update_minecraft_compare(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh
index 61cad6854..1e22053a1 100644
--- a/lgsm/functions/update_minecraft_bedrock.sh
+++ b/lgsm/functions/update_minecraft_bedrock.sh
@@ -47,13 +47,16 @@ fn_update_minecraft_localbuild(){
 		if [ "${status}" == "0" ]; then
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 			sleep 3
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		fi
 	fi
 
@@ -123,15 +126,18 @@ fn_update_minecraft_compare(){
 			command_start.sh
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_minecraft_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -150,18 +156,18 @@ fn_update_minecraft_compare(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh
index 5aaecc122..caf6bc57b 100644
--- a/lgsm/functions/update_mta.sh
+++ b/lgsm/functions/update_mta.sh
@@ -40,6 +40,7 @@ fn_update_mta_localbuild(){
 		command_stop.sh
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 		totalseconds=0
 		# Check again, allow time to generate logs.
 		while [ ! -f "${serverfiles}/mods/deathmatch/logs/server.log" ]; do
@@ -154,15 +155,18 @@ fn_update_mta_compare(){
 			command_start.sh
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_mta_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -181,18 +185,18 @@ fn_update_mta_compare(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh
index ee6a2b0ad..969913ba3 100644
--- a/lgsm/functions/update_mumble.sh
+++ b/lgsm/functions/update_mumble.sh
@@ -91,15 +91,18 @@ fn_update_mumble_compare(){
 			command_start.sh
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_mumble_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -118,18 +121,18 @@ fn_update_mumble_compare(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh
index 8a089c7f7..cfa6d6aa2 100644
--- a/lgsm/functions/update_steamcmd.sh
+++ b/lgsm/functions/update_steamcmd.sh
@@ -128,10 +128,12 @@ fn_update_steamcmd_compare(){
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_steamcmd_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
@@ -206,18 +208,18 @@ fn_appmanifest_check(){
 }
 
 fn_stop_warning(){
-	fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
-	fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn "this game server will be stopped during update"
+	fn_script_log_warn "this game server will be stopped during update"
 	totalseconds=3
 	for seconds in {3..1}; do
-		fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
+		fn_print_warn "this game server will be stopped during update: ${totalseconds}"
 		totalseconds=$((totalseconds - 1))
 		sleep 1
 		if [ "${seconds}" == "0" ]; then
 			break
 		fi
 	done
-	fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
+	fn_print_warn_nl "this game server will be stopped during update"
 }
 
 # The location where the builds are checked and downloaded.
@@ -235,6 +237,7 @@ if [ "${forceupdate}" == "1" ]; then
 		date +%s > "${lockdir}/lastupdate.lock"
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 	else
 		fn_update_steamcmd_dl
 		date +%s > "${lockdir}/lastupdate.lock"
diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh
index a5cc0dd60..5bcf14bff 100644
--- a/lgsm/functions/update_ts3.sh
+++ b/lgsm/functions/update_ts3.sh
@@ -44,6 +44,7 @@ fn_update_ts3_localbuild(){
 		command_stop.sh
 		exitbypass=1
 		command_start.sh
+		fn_commandname
 		totalseconds=0
 		# Check again, allow time to generate logs.
 		while [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do
@@ -152,15 +153,18 @@ fn_update_ts3_compare(){
 			command_start.sh
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 		# If server started.
 		else
 			fn_stop_warning
 			exitbypass=1
 			command_stop.sh
+			fn_commandname
 			exitbypass=1
 			fn_update_ts3_dl
 			exitbypass=1
 			command_start.sh
+			fn_commandname
 		fi
 		date +%s > "${lockdir}/lastupdate.lock"
 		alert="update"
diff --git a/linuxgsm.sh b/linuxgsm.sh
index aececaed8..849c76472 100755
--- a/linuxgsm.sh
+++ b/linuxgsm.sh
@@ -113,7 +113,7 @@ fn_bootstrap_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					echo -e "FAIL"
 					if [ -f "${lgsmlog}" ]; then
diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh
index da71c2b5a..adb465b1a 100644
--- a/tests/tests_fctrserver.sh
+++ b/tests/tests_fctrserver.sh
@@ -119,7 +119,7 @@ fn_bootstrap_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					echo -e "FAIL"
 					if [ -f "${lgsmlog}" ]; then
@@ -389,7 +389,7 @@ else
 			echo -en "copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				echo -e "FAIL"
 				exit 1
 			else
@@ -402,7 +402,7 @@ else
 				echo -en "copying _default.cfg...\c"
 				cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 				exitcode=$?
-				if [ ${exitcode} -ne 0 ]; then
+				if [ "${exitcode}" != 0 ]; then
 					echo -e "FAIL"
 					exit 1
 				else
diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh
index b52cf1f1b..eaf7047e9 100644
--- a/tests/tests_jc2server.sh
+++ b/tests/tests_jc2server.sh
@@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					echo -e "FAIL"
 					if [ -f "${lgsmlog}" ]; then
@@ -390,7 +390,7 @@ else
 			echo -en "copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				echo -e "FAIL"
 				exit 1
 			else
@@ -403,7 +403,7 @@ else
 				echo -en "copying _default.cfg...\c"
 				cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 				exitcode=$?
-				if [ ${exitcode} -ne 0 ]; then
+				if [ "${exitcode}" != 0 ]; then
 					echo -e "FAIL"
 					exit 1
 				else
diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh
index 8d7bab6b6..74b86b0d6 100644
--- a/tests/tests_mcserver.sh
+++ b/tests/tests_mcserver.sh
@@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					echo -e "FAIL"
 					if [ -f "${lgsmlog}" ]; then
@@ -390,7 +390,7 @@ else
 			echo -en "copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				echo -e "FAIL"
 				exit 1
 			else
@@ -403,7 +403,7 @@ else
 				echo -en "copying _default.cfg...\c"
 				cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 				exitcode=$?
-				if [ ${exitcode} -ne 0 ]; then
+				if [ "${exitcode}" != 0 ]; then
 					echo -e "FAIL"
 					exit 1
 				else
diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh
index fb4f889bf..d785fa0b5 100644
--- a/tests/tests_ts3server.sh
+++ b/tests/tests_ts3server.sh
@@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
 			fi
 
 			# On first try will error. On second try will fail.
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				if [ ${counter} -ge 2 ]; then
 					echo -e "FAIL"
 					if [ -f "${lgsmlog}" ]; then
@@ -390,7 +390,7 @@ else
 			echo -en "copying _default.cfg...\c"
 			cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 			exitcode=$?
-			if [ ${exitcode} -ne 0 ]; then
+			if [ "${exitcode}" != 0 ]; then
 				echo -e "FAIL"
 				exit 1
 			else
@@ -403,7 +403,7 @@ else
 				echo -en "copying _default.cfg...\c"
 				cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
 				exitcode=$?
-				if [ ${exitcode} -ne 0 ]; then
+				if [ "${exitcode}" != 0 ]; then
 					echo -e "FAIL"
 					exit 1
 				else