diff --git a/functions/fn_details b/functions/fn_details index d508003c0..2115772b3 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -2,101 +2,68 @@ # LGSM fn_details function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 101214 +# Version: 161214 -fn_sourcedetails(){ +fn_avalanchedetails(){ fn_autoip -fn_parms servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g') -rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g') pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) echo "" echo "${gamename} Server Details" echo "============================" echo "Server name: ${servername}" echo "Server IP: ${ip}:${port}" -echo "RCON password: ${rcon}" echo "Config file: ${servercfgfullpath}" echo "" -echo "Start Parameters" -echo "============================" -echo "${executable} ${parms}" -echo "" echo "Server Ports" echo "============================" echo "Ports the server is currently using." echo "" -echo "DIRECTION DESCRIPTION PORT" -echo "INBOUND Game/RCON port ${port}" -if [ ! -z "${sourcetvport}" ]; then - echo "INBOUND SourceTV port ${sourcetvport}" -fi -echo "OUTBOUND Client port ${clientport}" +echo "DIRECTION DESCRIPTION PORT" +echo "INBOUND Game port ${port}" echo "" echo "You can change ports by editing the" echo "start parameters in ${selfname}." echo "" if [ "${pid}" == "0" ]; then - echo -e "Status:\e[0;31m OFFLINE\e[0;39m" + echo -e "Status:\e[0;31m OFFLINE\e[0;39m" else - echo -e "Status:\e[0;32m ONLINE\e[0;39m" + echo -e "Status:\e[0;32m ONLINE\e[0;39m" fi echo "" } -fn_unrealdetails(){ +fn_realvirtualitydetails(){ fn_autoip +servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\//g'|tr -d '=\"; ') +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) -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}"|tr -d '\r'|tr -cd [:digit:]) -udplinkport=$((${gameport} + 2)) -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 - webadminuser=$(grep AdminName= "${systemdir}/${ini}"|sed 's/\AdminName=//g') -fi -webadminpass=$(grep AdminPassword= "${systemdir}/${ini}"|sed 's/\AdminPassword=//g') echo "" echo "${gamename} Server Details" echo "============================" echo "Server name: ${servername}" -echo "Server IP: ${ip}:${gameport}" -echo "Config file: ${systemdir}/${ini}" +echo "Server IP: ${ip}:${serverport}" +echo "Config file: ${servercfgfullpath}" +echo "" +echo "Admin Password: ${adminpass}" echo "" echo "Server Ports" echo "============================" echo "Ports the server is currently using." echo "" -echo "DIRECTION DESCRIPTION PORT INI VARIABLE" -echo "INBOUND Game Port ${gameport} UDP Port=${gameport}" -echo "INBOUND Query Port ${queryport} UDP n/a" -if [ "${engine}" == "unreal" ]; then - echo "OUTBOUND UdpLink Port (random) ${udplinkport}+ UDP n/a" -fi -if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then - echo "INBOUND GameSpy Query Port ${gsqueryport} UDP OldQueryPortNumber=${gsqueryport}" -fi -if [ "${appid}" == "215360" ]; then - echo "OUTBOUND Master Server port 28852 TCP/UDP n/a" -else - echo "OUTBOUND Master Server port 28900/28902 TCP/UDP n/a" -fi -if [ "${appid}" ]; then - if [ "${appid}" == "223250" ]; then - echo "OUTBOUND Steam Port 20610 UDP n/a" - else - echo "OUTBOUND Steam Port 20660 UDP n/a" - fi +if [ -z ${serverport} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then + echo -e "\e[0;31mERROR!\e[0;39m Missing/commented ports in ${servercfg}." + echo "" fi -echo "INBOUND WebAdmin ${webadminport} TCP ListenPort=${webadminport}" +echo "PROTOCOL DESCRIPTION PORT" +echo "UDP Game port ${serverport}" +echo "UDP STEAM query port ${queryport}" +echo "UDP STEAM master traffic port ${masterport}" echo "" -echo "${servername} WebAdmin" -echo "=======================" -echo "WebAdmin URL: http://${ip}:${webadminport}" -echo "WebAdmin Username: ${webadminuser}" -echo "WebAdmin Password: ${webadminpass}" +echo "You can change ports by editing the" +echo "parameters in ${servercfgfullpath}" echo "" if [ "${pid}" == "0" ]; then echo -e "Status:\e[0;31m OFFLINE\e[0;39m" @@ -106,15 +73,21 @@ fi echo "" } -fn_ns2details(){ +fn_seriousengine35details(){ fn_autoip -queryport=$((${port} + 1)) +fn_parms +servername=$(grep -s prj_strMultiplayerSessionName "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|sed 's/"//g'|sed 's/;//g') +rcon=$(grep -s rcts_strAdminPassword "${servercfgfullpath}"|sed 's/rcts_strAdminPassword = //g'|sed 's/"//g'|sed 's/;//g') +gameport=$(grep -s prj_uwPort "${servercfgfullpath}"|tr -d '\r'|tr -cd [:digit:]) +queryport=$((${gameport} + 1)) pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) echo "" echo "${gamename} Server Details" echo "============================" echo "Server name: ${servername}" echo "Server IP: ${ip}:${port}" +echo "RCON password: ${rcon}" +echo "Config file: ${servercfgfullpath}" echo "" echo "Server Ports" echo "============================" @@ -122,17 +95,10 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -echo "INBOUND Query Port ${queryport}" -echo "INBOUND WebAdmin ${webadminport}" -echo "" -echo "${servername} WebAdmin" -echo "=======================" -echo "WebAdmin URL: http://${ip}:${webadminport}/index.html" -echo "WebAdmin Username: ${webadminuser}" -echo "WebAdmin Password: ${webadminpass}" +echo "INBOUND Query port ${queryport}" echo "" -echo "You can change various parameters by editing the" -echo "start parameters in ${selfname}." +echo "You can change ports by editing the" +echo "parameters in ${servercfgfullpath}" echo "" if [ "${pid}" == "0" ]; then echo -e "Status:\e[0;31m OFFLINE\e[0;39m" @@ -142,27 +108,74 @@ fi echo "" } -fn_jc2details(){ +fn_sourcedetails(){ fn_autoip +fn_parms servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g') +rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g') pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) echo "" echo "${gamename} Server Details" echo "============================" echo "Server name: ${servername}" echo "Server IP: ${ip}:${port}" +echo "RCON password: ${rcon}" echo "Config file: ${servercfgfullpath}" echo "" +echo "Start Parameters" +echo "============================" +echo "${executable} ${parms}" +echo "" echo "Server Ports" echo "============================" echo "Ports the server is currently using." echo "" -echo "DIRECTION DESCRIPTION PORT" -echo "INBOUND Game port ${port}" +echo "DIRECTION DESCRIPTION PORT" +echo "INBOUND Game/RCON port ${port}" +if [ ! -z "${sourcetvport}" ]; then + echo "INBOUND SourceTV port ${sourcetvport}" +fi +echo "OUTBOUND Client port ${clientport}" echo "" echo "You can change ports by editing the" echo "start parameters in ${selfname}." echo "" +if [ "${pid}" == "0" ]; then + echo -e "Status:\e[0;31m OFFLINE\e[0;39m" +else + echo -e "Status:\e[0;32m ONLINE\e[0;39m" +fi +echo "" +} + +fn_sparkdetails(){ +fn_autoip +queryport=$((${port} + 1)) +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) +echo "" +echo "${gamename} Server Details" +echo "============================" +echo "Server name: ${servername}" +echo "Server IP: ${ip}:${port}" +echo "" +echo "Server Ports" +echo "============================" +echo "Ports the server is currently using." +echo "" +echo "DIRECTION DESCRIPTION PORT" +echo "INBOUND Game/RCON port ${port}" +echo "INBOUND Query port ${queryport}" +echo "INBOUND WebAdmin ${webadminport}" +echo "" +echo "${servername} WebAdmin" +echo "=======================" +echo "WebAdmin URL: http://${ip}:${webadminport}/index.html" +echo "WebAdmin Username: ${webadminuser}" +echo "WebAdmin Password: ${webadminpass}" +echo "" +echo "You can change various parameters by editing the" +echo "start parameters in ${selfname}." +echo "" if [ "${pid}" == "0" ]; then echo -e "Status:\e[0;31m OFFLINE\e[0;39m" else @@ -171,37 +184,59 @@ fi echo "" } -fn_arma3details(){ +fn_unrealdetails(){ fn_autoip -servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\//g'|tr -d '=\"; ') -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) +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}"|tr -d '\r'|tr -cd [:digit:]) +udplinkport=$((${gameport} + 2)) +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 + webadminuser=$(grep AdminName= "${systemdir}/${ini}"|sed 's/\AdminName=//g') +fi +webadminpass=$(grep AdminPassword= "${systemdir}/${ini}"|sed 's/\AdminPassword=//g') echo "" echo "${gamename} Server Details" echo "============================" echo "Server name: ${servername}" -echo "Server IP: ${ip}:${serverport}" -echo "Config file: ${servercfgfullpath}" -echo "" -echo "Admin Password: ${adminpass}" +echo "Server IP: ${ip}:${gameport}" +echo "Config file: ${systemdir}/${ini}" echo "" echo "Server Ports" echo "============================" echo "Ports the server is currently using." echo "" -if [ -z ${serverport} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then - echo -e "\e[0;31mERROR!\e[0;39m Missing/commented ports in ${servercfg}." - echo "" +echo "DIRECTION DESCRIPTION PORT INI VARIABLE" +echo "INBOUND Game port ${gameport} UDP Port=${gameport}" +echo "INBOUND Query port ${queryport} UDP n/a" +if [ "${engine}" == "unreal" ]; then + echo "OUTBOUND UdpLink Port (random) ${udplinkport}+ UDP n/a" fi -echo "PROTOCOL DESCRIPTION PORT" -echo "UDP Game port ${serverport}" -echo "UDP STEAM query port ${queryport}" -echo "UDP STEAM master traffic port ${masterport}" +if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then + echo "INBOUND GameSpy query port ${gsqueryport} UDP OldQueryPortNumber=${gsqueryport}" +fi +if [ "${appid}" == "215360" ]; then + echo "OUTBOUND Master server port 28852 TCP/UDP n/a" +else + echo "OUTBOUND Master server port 28900/28902 TCP/UDP n/a" +fi +if [ "${appid}" ]; then + if [ "${appid}" == "223250" ]; then + echo "OUTBOUND Steam port 20610 UDP n/a" + else + echo "OUTBOUND Steam port 20660 UDP n/a" + fi +fi +echo "INBOUND WebAdmin ${webadminport} TCP ListenPort=${webadminport}" echo "" -echo "You can change ports by editing the" -echo "parameters in ${servercfgfullpath}" +echo "${servername} WebAdmin" +echo "=======================" +echo "WebAdmin URL: http://${ip}:${webadminport}" +echo "WebAdmin Username: ${webadminuser}" +echo "WebAdmin Password: ${webadminpass}" echo "" if [ "${pid}" == "0" ]; then echo -e "Status:\e[0;31m OFFLINE\e[0;39m" @@ -211,16 +246,18 @@ fi echo "" } -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then +if [ "${engine}" == "avalanche" ]; then + fn_avalanchedetails +elif [ "${engine}" == "realvirtuality" ]; then + fn_realvirtualitydetails +elif [ "${engine}" == "seriousengine35" ]; then + fn_seriousengine35details +elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then fn_sourcedetails +elif [ "${engine}" == "spark" ]; then + fn_sparkdetails elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then fn_unrealdetails -elif [ "${engine}" == "spark" ]; then - fn_ns2details -elif [ "${engine}" == "avalanche" ]; then - fn_jc2details -elif [ "${engine}" == "realvirtuality" ]; then - fn_arma3details else echo "error: Unable to detect server engine!" fi \ No newline at end of file