From 840c28011d1744734f3885f08a48da2fd3531e6f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 19:45:46 +0000 Subject: [PATCH 1/6] Added check_config.sh This function checks that servercfgfullpath exists and warns if missing --- functions/check.sh | 10 ++++++++-- functions/check_config.sh | 14 ++++++++++++++ functions/core_functions.sh | 7 ++++++- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 functions/check_config.sh diff --git a/functions/check.sh b/functions/check.sh index 909c04777..3456408cc 100644 --- a/functions/check.sh +++ b/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,10 @@ do if [ "${allowed_command}" == "${function_selfname}" ]; then check_tmux.sh fi -done \ No newline at end of file +done + +if [ "${function_selfname}" != "command_install.sh" ]; then + if [ "${allowed_command}" == "${function_selfname}" ]; then + check_config.sh + fi +fi \ No newline at end of file diff --git a/functions/check_config.sh b/functions/check_config.sh new file mode 100644 index 000000000..782b6ec9e --- /dev/null +++ b/functions/check_config.sh @@ -0,0 +1,14 @@ +#!/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 "Configuration file missing" + echo "${servercfgfullpath}" + fi +fi \ No newline at end of file diff --git a/functions/core_functions.sh b/functions/core_functions.sh index 698365058..7f97004ef 100644 --- a/functions/core_functions.sh +++ b/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 From 41513970f3ce645b8ee6ba9df40efb631982f75c Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 20:00:30 +0000 Subject: [PATCH 2/6] Removed confi check from details --- functions/command_details.sh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/functions/command_details.sh b/functions/command_details.sh index 6cf79674d..ef63a08f9 100644 --- a/functions/command_details.sh +++ b/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 From b276263dae5fc1d50a83df2cc6bfee4edf8c6944 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 20:00:46 +0000 Subject: [PATCH 3/6] Monitor update check_config --- functions/check.sh | 4 +--- functions/check_config.sh | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/check.sh b/functions/check.sh index 3456408cc..fd8b57a30 100644 --- a/functions/check.sh +++ b/functions/check.sh @@ -62,7 +62,5 @@ do done if [ "${function_selfname}" != "command_install.sh" ]; then - if [ "${allowed_command}" == "${function_selfname}" ]; then - check_config.sh - fi + check_config.sh fi \ No newline at end of file diff --git a/functions/check_config.sh b/functions/check_config.sh index 782b6ec9e..8e2d6bc44 100644 --- a/functions/check_config.sh +++ b/functions/check_config.sh @@ -10,5 +10,8 @@ if [ ! -e "${servercfgfullpath}" ]; then if [ "${gamename}" != "Hurtworld" ]; then fn_printwarnnl "Configuration file missing" echo "${servercfgfullpath}" + fn_scriptlog "Configuration file missing" + fn_scriptlog "${servercfgfullpath}" + sleep 2 fi fi \ No newline at end of file From 742abe2d0952312ae48a3a6fd02a1ecbc6d41207 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 20:07:25 +0000 Subject: [PATCH 4/6] ! --- functions/check_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/check_config.sh b/functions/check_config.sh index 8e2d6bc44..e12d942c0 100644 --- a/functions/check_config.sh +++ b/functions/check_config.sh @@ -8,9 +8,9 @@ lgsm_version="060116" if [ ! -e "${servercfgfullpath}" ]; then if [ "${gamename}" != "Hurtworld" ]; then - fn_printwarnnl "Configuration file missing" + fn_printwarnnl "Configuration file missing!" echo "${servercfgfullpath}" - fn_scriptlog "Configuration file missing" + fn_scriptlog "Configuration file missing!" fn_scriptlog "${servercfgfullpath}" sleep 2 fi From 139c7e8aa6cced0499c0676cdc0d74dfc6708384 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 20:14:35 +0000 Subject: [PATCH 5/6] Removed servercfgfullpath Moved this as causing issues with the new warning message. Now MISSING! is not displayed in the details. However this is still a warning before details are loaded. --- functions/info_config.sh | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/functions/info_config.sh b/functions/info_config.sh index 0af342894..60d2d77e0 100644 --- a/functions/info_config.sh +++ b/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 From 37c3f7f2e27414c698e592598bce76d3a855a697 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 6 Jan 2016 20:23:28 +0000 Subject: [PATCH 6/6] Adjusted to run on specific commands --- functions/check.sh | 10 +++++++--- functions/check_config.sh | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/functions/check.sh b/functions/check.sh index fd8b57a30..86e141416 100644 --- a/functions/check.sh +++ b/functions/check.sh @@ -61,6 +61,10 @@ do fi done -if [ "${function_selfname}" != "command_install.sh" ]; then - check_config.sh -fi \ No newline at end of file +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 \ No newline at end of file diff --git a/functions/check_config.sh b/functions/check_config.sh index e12d942c0..24d32318f 100644 --- a/functions/check_config.sh +++ b/functions/check_config.sh @@ -8,7 +8,7 @@ lgsm_version="060116" if [ ! -e "${servercfgfullpath}" ]; then if [ "${gamename}" != "Hurtworld" ]; then - fn_printwarnnl "Configuration file missing!" + fn_printwarnnl "Config file missing!" echo "${servercfgfullpath}" fn_scriptlog "Configuration file missing!" fn_scriptlog "${servercfgfullpath}"