Browse Source

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
pull/254/merge
Daniel Gibbs 10 years ago
parent
commit
81d55119f9
  1. 14
      functions/fn_details
  2. 6
      functions/fn_serverquery

14
functions/fn_details

@ -2,7 +2,7 @@
# LGSM fn_details function # LGSM fn_details function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk # Website: http://danielgibbs.co.uk
# Version: 081214 # Version: 101214
fn_sourcedetails(){ fn_sourcedetails(){
fn_autoip fn_autoip
@ -47,11 +47,11 @@ echo ""
fn_unrealdetails(){ fn_unrealdetails(){
fn_autoip fn_autoip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) 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)) 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)) 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 if [ "${engine}" == "unreal" ]; then
webadminuser=$(grep AdminUsername= "${systemdir}/${ini}"|sed 's/\AdminUsername=//g') webadminuser=$(grep AdminUsername= "${systemdir}/${ini}"|sed 's/\AdminUsername=//g')
else else
@ -174,9 +174,9 @@ echo ""
fn_arma3details(){ fn_arma3details(){
fn_autoip fn_autoip
servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\<hostname\>//g'|tr -d '=\"; ') servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\<hostname\>//g'|tr -d '=\"; ')
serverport=$(grep -s serverport= "${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 -cd [:digit:]) queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
masterport=$(grep -s steamport= "${servercfgfullpath}"|grep -v //|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) pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo "" echo ""
echo "${gamename} Server Details" echo "${gamename} Server Details"

6
functions/fn_serverquery

@ -2,18 +2,18 @@
# LGSM fn_serverquery function # LGSM fn_serverquery function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk # Website: http://danielgibbs.co.uk
# Version: 081214 # Version: 101214
# uses gsquery.py to directly query the server # uses gsquery.py to directly query the server
# detects if the server locks up # detects if the server locks up
if [ -f gsquery.py ]; then if [ -f gsquery.py ]; then
if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; 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)) port=$((${gameport} + 1))
elif [ "${engine}" == "spark" ]; then elif [ "${engine}" == "spark" ]; then
port=$((${port} + 1)) port=$((${port} + 1))
elif [ "${engine}" == "realvirtuality" ]; then 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} port=${queryport}
fi fi
fn_printinfo "Monitoring ${servicename}: Detected gsquery.py" fn_printinfo "Monitoring ${servicename}: Detected gsquery.py"

Loading…
Cancel
Save