Просмотр исходного кода

Merge pull request #611 from dgibbs64/check-config

check_config.sh
Daniel Gibbs 10 лет назад
Родитель
Сommit
615a764751

+ 9 - 1
functions/check.sh

@@ -2,7 +2,7 @@
 # LGSM fn_check function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="060116"
 
 # Description: Overall function for managing checks.
 # Runs checks that will either halt on or fix an issue.
@@ -59,4 +59,12 @@ do
 	if [ "${allowed_command}" == "${function_selfname}" ]; then
 		check_tmux.sh
 	fi
+done
+
+local allowed_commands_array=( command_console.sh command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
+		check_config.sh
+	fi
 done

+ 17 - 0
functions/check_config.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+# LGSM check_config.sh function
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+lgsm_version="060116"
+
+# Description: If server config missing warn user.
+
+if [ ! -e "${servercfgfullpath}" ]; then
+	if [ "${gamename}" != "Hurtworld" ]; then
+		fn_printwarnnl "Config file missing!"
+		echo "${servercfgfullpath}"
+		fn_scriptlog "Configuration file missing!"
+		fn_scriptlog "${servercfgfullpath}"
+		sleep 2
+	fi
+fi

+ 1 - 18
functions/command_details.sh

@@ -2,7 +2,7 @@
 # LGSM command_details.sh function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="060116"
 
 # Description: Displays server infomation.
 
@@ -581,23 +581,6 @@ fn_details_statusbottom
 
 # Run checks and gathers details to display.
 check.sh 
-
-if [ ! -e "${servercfgfullpath}" ]; then
-	if [ "${gamename}" != "Hurtworld" ]; then
-		echo ""
-		fn_printwarnnl "\e[0;31mCONFIGURATION FILE MISSING!\e[0m"
-		echo "${servercfgfullpath}"
-		echo "Some details cannot be displayed"
-		echo -en ".\r"
-		sleep 1
-		echo -en "..\r"
-		sleep 1
-		echo -en "...\r"
-		sleep 1
-		echo -en "   \r"
-	fi
-fi
-
 info_config.sh
 info_distro.sh
 info_glibc.sh

+ 6 - 1
functions/core_functions.sh

@@ -2,7 +2,7 @@
 # LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-lgsm_version="030116"
+lgsm_version="060116"
 
 # Description: Defines all functions to allow download and execution of functions using fn_runfunction.
 # This function is called first before any other function. Without this file other functions would not load.
@@ -101,6 +101,11 @@ functionfile="${FUNCNAME}"
 fn_runfunction
 }
 
+check_config.sh(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
 check_ip.sh(){
 functionfile="${FUNCNAME}"
 fn_runfunction

+ 1 - 31
functions/info_config.sh

@@ -2,7 +2,7 @@
 # LGSM info_config.sh function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="060116"
 
 # Description: Gets specific details from config files.
 
@@ -12,12 +12,6 @@ lgsm_version="271215"
 # tr -d '=\"; ' remove selected charectors =\";
 # grep -v "foo" filter out lines that contain foo
 
-fn_servercfgfullpath(){
-if [ ! -f "${servercfgfullpath}" ]; then
-	servercfgfullpath="\e[0;31mMISSING!\e[0m ${servercfgfullpath}"
-fi
-}
-
 ## Just Cause 2
 if [ "${engine}" == "avalanche" ]; then
 
@@ -68,8 +62,6 @@ if [ "${engine}" == "avalanche" ]; then
 		port="0"
 	fi
 
-	fn_servercfgfullpath
-
 ## Dont Starve Together
 elif [ "${engine}" == "dontstarve" ]; then
 
@@ -131,8 +123,6 @@ elif [ "${engine}" == "dontstarve" ]; then
 		port="0"
 	fi
 
-	fn_servercfgfullpath
-
 ## Project Zomboid
 elif [ "${engine}" == "projectzomboid" ]; then
 
@@ -164,8 +154,6 @@ elif [ "${engine}" == "projectzomboid" ]; then
 		port="0"
 	fi
 
-	fn_servercfgfullpath
-
 # ARMA 3
 elif [ "${engine}" == "realvirtuality" ]; then
 
@@ -233,8 +221,6 @@ elif [ "${engine}" == "realvirtuality" ]; then
                 masterport="0"
         fi
 
-	fn_servercfgfullpath
-
 # Serious Sam
 elif [ "${engine}" == "seriousengine35" ]; then
 
@@ -294,8 +280,6 @@ elif [ "${engine}" == "seriousengine35" ]; then
 		queryport="0"
 	fi
 
-	fn_servercfgfullpath
-
 # Source Engine Games
 elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
 
@@ -329,8 +313,6 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
 		rconpassword="\e[0;31mUNAVAILABLE\e[0m"
 	fi
 
-	fn_servercfgfullpath
-
 # Spark (NS2: Combat)
 elif [ "${engine}" == "spark" ]; then
 
@@ -342,8 +324,6 @@ elif [ "${engine}" == "spark" ]; then
 		queryport="0"
 	fi
 
-	fn_servercfgfullpath
-
 # Teamspeak 3
 elif [ "${gamename}" == "Teamspeak 3" ]; then
 
@@ -390,8 +370,6 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
 		fileport="30033"
 	fi
 
-	fn_servercfgfullpath
-
 # Teeworlds
 elif [ "${engine}" == "teeworlds" ]; then
 
@@ -443,8 +421,6 @@ elif [ "${engine}" == "teeworlds" ]; then
 		slots="12"
 	fi
 
-	fn_servercfgfullpath
-
 # Terraria
 elif [ "${engine}" == "terraria" ]; then
 
@@ -591,8 +567,6 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
 		queryport="0"
 	fi
 
-	fn_servercfgfullpath
-
 # Hurtworld (unity3d)
 elif [ "${gamename}" == "Hurtworld" ]; then
 
@@ -763,8 +737,6 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
 
 	fi
 
-	fn_servercfgfullpath
-
 # ARK: Survivaial Evolved
 elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
 
@@ -832,6 +804,4 @@ elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
 		queryport="0"
 	fi
 
-	fn_servercfgfullpath
-
 fi