Pārlūkot izejas kodu

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
Daniel Gibbs 11 gadi atpakaļ
vecāks
revīzija
81d55119f9
2 mainītis faili ar 10 papildinājumiem un 10 dzēšanām
  1. 7 7
      functions/fn_details
  2. 3 3
      functions/fn_serverquery

+ 7 - 7
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/\<hostname\>//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"

+ 3 - 3
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"