gameservergame-servergame-servershacktoberfestdedicated-game-serversgamelinuxgsmserverbashgaminglinuxmultiplayer-game-servershell
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
309 lines
10 KiB
309 lines
10 KiB
#!/bin/bash
|
|
# LGSM fn_details function
|
|
# Author: Daniel Gibbs
|
|
# Website: http://danielgibbs.co.uk
|
|
# Version: 231214
|
|
|
|
fn_avalanchedetails(){
|
|
fn_autoip
|
|
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //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 "Config file: ${servercfgfullpath}"
|
|
echo ""
|
|
echo "Server Ports"
|
|
echo "============================"
|
|
echo "Ports the server is currently using."
|
|
echo ""
|
|
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"
|
|
else
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
fn_realvirtualitydetails(){
|
|
fn_autoip
|
|
servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\<hostname\>//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)
|
|
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 ""
|
|
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 ""
|
|
fi
|
|
echo "PROTOCOL DESCRIPTION PORT"
|
|
echo "UDP Game port ${serverport}"
|
|
echo "UDP STEAM query port ${queryport}"
|
|
echo "UDP STEAM master traffic port ${masterport}"
|
|
echo ""
|
|
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"
|
|
else
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
fn_seriousengine35details(){
|
|
fn_autoip
|
|
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 "============================"
|
|
echo "Ports the server is currently using."
|
|
echo ""
|
|
echo "DIRECTION DESCRIPTION PORT"
|
|
echo "INBOUND Game/RCON port ${port}"
|
|
echo "INBOUND Query port ${queryport}"
|
|
echo ""
|
|
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"
|
|
else
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
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/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
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
fn_unity3ddetails(){
|
|
fn_autoip
|
|
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
|
|
servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
|
|
gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:])
|
|
queryport=$((${gameport} + 1))
|
|
webadminenabled=$(grep ControlPanelEnabled "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
|
|
webadminport=$(grep ControlPanelPort "${servercfgfullpath}"|tr -cd [:digit:])
|
|
telnetport=$(grep TelnetPort "${servercfgfullpath}"|tr -cd [:digit:])
|
|
webadminuser=$(grep ControlPanelPassword "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
|
|
echo ""
|
|
echo "${gamename} Server Details"
|
|
echo "============================"
|
|
echo "Server name: ${servername}"
|
|
echo "Server IP: ${ip}:${gameport}"
|
|
echo "Config file: ${servercfgfullpath}"
|
|
echo ""
|
|
echo "Server Ports"
|
|
echo "============================"
|
|
echo "Ports the server is currently using."
|
|
echo ""
|
|
echo "DIRECTION DESCRIPTION PORT"
|
|
echo "INBOUND Game port ${gameport}"
|
|
echo "INBOUND Query port ${queryport}"
|
|
echo "INBOUND WebAdmin ${webadminport}"
|
|
echo "INBOUND Telnet ${telnetport}"
|
|
echo ""
|
|
echo "${servername} WebAdmin"
|
|
echo "======================="
|
|
echo "WebAdmin Enabled: ${webadminenabled}"
|
|
echo "WebAdmin URL: http://${ip}:${webadminport}"
|
|
echo "WebAdmin Username: ${webadminuser}"
|
|
echo ""
|
|
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"
|
|
else
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
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|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 ""
|
|
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
|
|
fi
|
|
echo "INBOUND WebAdmin ${webadminport} TCP ListenPort=${webadminport}"
|
|
echo ""
|
|
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"
|
|
else
|
|
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
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}" == "unity3d" ]; then
|
|
fn_unity3ddetails
|
|
elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
|
|
fn_unrealdetails
|
|
else
|
|
echo "error: Unable to detect server engine!"
|
|
fi
|