From 81d55119f9557dd592a176762849576ebc12a586 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Dec 2014 11:17:22 +0000 Subject: [PATCH] Only digits will output from config files Removed the chance of carriage return and made sure only digits are output. Should help reduce the chance of off things being output to the port vars --- functions/fn_details | 14 +++++++------- functions/fn_serverquery | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/fn_details b/functions/fn_details index a0f3799ed..d508003c0 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -2,7 +2,7 @@ # LGSM fn_details function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 081214 +# Version: 101214 fn_sourcedetails(){ fn_autoip @@ -47,11 +47,11 @@ echo "" fn_unrealdetails(){ fn_autoip pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) -gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|sed 's/\Port=//g'|tr -d '\r') +gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:]) queryport=$((${gameport} + 1)) -gsqueryport=$(grep OldQueryPortNumber= "${systemdir}/${ini}"|sed 's/\OldQueryPortNumber=//g') +gsqueryport=$(grep OldQueryPortNumber= "${systemdir}/${ini}"|tr -d '\r'|tr -cd [:digit:]) udplinkport=$((${gameport} + 2)) -webadminport=$(grep ListenPort= "${systemdir}/${ini}"|sed 's/\ListenPort=//g') +webadminport=$(grep ListenPort= "${systemdir}/${ini}"|tr -d '\r'|tr -cd [:digit:]) if [ "${engine}" == "unreal" ]; then webadminuser=$(grep AdminUsername= "${systemdir}/${ini}"|sed 's/\AdminUsername=//g') else @@ -174,9 +174,9 @@ echo "" fn_arma3details(){ fn_autoip servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\//g'|tr -d '=\"; ') -serverport=$(grep -s serverport= "${servercfgfullpath}"|grep -v //|tr -cd [:digit:]) -queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -cd [:digit:]) -masterport=$(grep -s steamport= "${servercfgfullpath}"|grep -v //|tr -cd [:digit:]) +serverport=$(grep -s serverport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:]) +queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:]) +masterport=$(grep -s steamport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:]) pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) echo "" echo "${gamename} Server Details" diff --git a/functions/fn_serverquery b/functions/fn_serverquery index 1e780f3da..c6cd89fb5 100644 --- a/functions/fn_serverquery +++ b/functions/fn_serverquery @@ -2,18 +2,18 @@ # LGSM fn_serverquery function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 081214 +# Version: 101214 # uses gsquery.py to directly query the server # detects if the server locks up if [ -f gsquery.py ]; then if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then - gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|sed 's/\Port=//g'|tr -d '\r') + gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:]) port=$((${gameport} + 1)) elif [ "${engine}" == "spark" ]; then port=$((${port} + 1)) elif [ "${engine}" == "realvirtuality" ]; then - queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -cd [:digit:]) + queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:]) port=${queryport} fi fn_printinfo "Monitoring ${servicename}: Detected gsquery.py"