| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- #!/bin/bash
- # LGSM fn_details function
- # Author: Daniel Gibbs
- # Website: http://danielgibbs.co.uk
- # Version: 080214
- # Description: Displays server infomation.
- # Standard Details
- # This applies to all engines
- fn_details_os(){
- echo -e ""
- echo -e "\e[93mDistro Details\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mDistro:£\e[0m${os}" >> .fn_details_distro
- echo -e "\e[34mArch:£\e[0m${arch}" >> .fn_details_distro
- echo -e "\e[34mKernel:£\e[0m${kernel}" >> .fn_details_distro
- echo -e "\e[34mHostname:£\e[0m$HOSTNAME" >> .fn_details_distro
- echo -e "\e[34mtmux:£\e[0m${tmuxv}" >> .fn_details_distro
- echo -e "\e[34mGLIBC:£\e[0m${glibcv}" >> .fn_details_distro
- column -s '£' -t .fn_details_distro
- rm -f .fn_details_distro
- }
- fn_details_performance(){
- echo -e ""
- echo -e "\e[93mPerformance\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mUptime:£\e[0m${days}d, ${hours}h, ${minutes}m" >> .fn_details_performance
- echo -e "\e[34mAvg Load:£\e[0m${load}" >> .fn_details_performance
- column -s '£' -t .fn_details_performance
- rm -f .fn_details_performance
- echo -e ""
- echo -e "\e[34mMem:£\e[34mtotal£ used£ free\e[0m" >> .fn_details_performance
- echo -e "\e[34mPhysical:£\e[0m${physmemtotal}£${physmemused}£${physmemfree}\e[0m" >> .fn_details_performance
- echo -e "\e[34mSwap:£\e[0m${swaptotal}£${swapused}£${swapfree}\e[0m" >> .fn_details_performance
- column -s '£' -t .fn_details_performance
- rm -f .fn_details_performance
- }
- fn_details_disk(){
- echo -e ""
- echo -e "\e[93mDisk Usage\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mDisk available:£\e[0m${availspace}" >> .fn_details_disk
- echo -e "\e[34mServerfiles:£\e[0m${serverfilesdu}" >> .fn_details_disk
- if [ -d "${backupdir}" ]; then
- echo -e "\e[34mBackups:£\e[0m${backupdirdu}" >> .fn_details_disk
- fi
- column -s '£' -t .fn_details_disk
- rm -f .fn_details_disk
- }
- fn_details_gameserver(){
- if [ ! -e ${servercfgfullpath} ]; then
- servername="\e[0;31mCONFIG FILE MISSING!\e[0m"
- rcon="\e[0;31mCONFIG FILE MISSING!\e[0m"
- servercfgfullpath="${servercfgfullpath} \e[0;31mCONFIG FILE MISSING!!\e[0m"
- fi
- echo -e ""
- echo -e "\e[92m${gamename} Server Details\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mServer name:£\e[0m${servername}" >> .fn_details_gameserver
- echo -e "\e[34mServer IP:£\e[0m${ip}:${port}" >> .fn_details_gameserver
- if [ ! -z "${rcon}" ]; then
- echo -e "\e[34mRCON password:£\e[0m${rcon}" >> .fn_details_gameserver
- fi
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- if [ "${pid}" == "0" ]; then
- echo -e "\e[34mStatus:£\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver
- else
- echo -e "\e[34mStatus:£\e[0;32mONLINE\e[0m" >> .fn_details_gameserver
- fi
- column -s '£' -t .fn_details_gameserver
- rm -f .fn_details_gameserver
- echo -e ""
- echo -e "\e[34mService name:£\e[0m${servicename}" >> .fn_details_gameserver
- echo -e "\e[34mUser:£\e[0m$(whoami)" >> .fn_details_gameserver
- echo -e "\e[34mLocation:£\e[0m${rootdir}" >> .fn_details_gameserver
- if [ ! -z "${servercfgfullpath}" ]; then
- echo -e "\e[34mConfig file:£\e[0m${servercfgfullpath}" >> .fn_details_gameserver
- fi
- if [ "${gamename}" == "Teamspeak 3" ]; then
- echo -e "\e[34mdbplugin:£\e[0m${dbplugin}" >> .fn_details_gameserver
- fi
- column -s '£' -t .fn_details_gameserver
- rm -f .fn_details_gameserver
- }
- fn_details_backup(){
- echo -e ""
- echo -e "\e[92mBackups\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
- echo -e "No Backups created"
- else
- echo -e "\e[34mNo. of backups:£\e[0m${backupcount}" >> .fn_details_backup
- echo -e "\e[34mLatest backup:\e[0m" >> .fn_details_backup
- echo -e "\e[34m date:£\e[0m${lastbackupdate}" >> .fn_details_backup
- echo -e "\e[34m file:£\e[0m${lastbackup}" >> .fn_details_backup
- echo -e "\e[34m size:£\e[0m${lastbackupsize}" >> .fn_details_backup
- column -s '£' -t .fn_details_backup
- rm -f .fn_details_backup
- fi
- }
- fn_details_commandlineparms(){
- echo -e ""
- echo -e "\e[92mCommand-line Parameters\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "${executable} ${parms}"
- }
- fn_details_statusbottom(){
- echo -e ""
- if [ "${pid}" == "0" ]; then
- echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
- else
- echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
- fi
- echo -e ""
- }
- # Engine Specific details
- fn_details_avalanche(){
- fn_check_ip
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the command-line"
- echo -e "parameters in ${selfname}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep Jcmp-Server"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_realvirtuality(){
- fn_check_ip
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the parameters in"
- echo -e "${servercfgfullpath}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep arma3server"
- echo -e ""
- if [ -z ${port} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then
- echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
- echo -e ""
- fi
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game£INBOUND£${port}£udp" >> .fn_details_ports
- echo -e "> Steam: Query£INBOUND£${queryport}£udp" >> .fn_details_ports
- echo -e "> Steam: Master traffic£INBOUND£${masterport}£udp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_seriousengine35(){
- fn_check_ip
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the parameters in"
- echo -e "${servercfgfullpath}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep Sam3_Dedicate"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game/RCON£INBOUND£${port}£tcp" >> .fn_details_ports
- echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_source(){
- fn_check_ip
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the command-line"
- echo -e "parameters in ${selfname}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep srcds_linux"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game/RCON£INBOUND£${port}£tcp/udp" >> .fn_details_ports
- if [ ! -z "${sourcetvport}" ]; then
- echo -e "> SourceTV£INBOUND£${sourcetvport}£udp" >> .fn_details_ports
- fi
- echo -e "< Client£OUTBOUND£${clientport}£udp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_spark(){
- fn_check_ip
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the command-line"
- echo -e "parameters in ${selfname}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep server_linux3"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
- echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
- echo -e "> WebAdmin£INBOUND£${webadminport}£tcp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- echo -e ""
- echo -e "\e[92m${servername} WebAdmin\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}/index.html" >> .fn_details_ports
- echo -e "\e[34mWebAdmin username:£\e[0m${webadminuser}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_teamspeak3(){
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the command-line"
- echo -e "parameters in ${selfname}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep ts3server"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Voice£INBOUND£${port}£udp" >> .fn_details_ports
- echo -e "> ServerQuery£INBOUND£${queryport}£tcp" >> .fn_details_ports
- echo -e "> File transfer£INBOUND£${fileport}£tcp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_unity3d(){
- fn_check_ip
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the parameters in"
- echo -e "${servercfgfullpath}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep 7DaysToDie"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
- echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
- echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
- echo -e "> WebAdmin£INBOUND£${webadminport}£tcp" >> .fn_details_ports
- echo -e "> Telnet£INBOUND£${telnetport}£tcp" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- echo -e ""
- echo -e "\e[92m${servername} WebAdmin\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mWebAdmin enabled:£\e[0m${webadminenabled}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- echo -e ""
- echo -e "\e[92m${servername} Telnet\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mTelnet enabled:£\e[0m${telnetenabled}" >> .fn_details_ports
- echo -e "\e[34mTelnet address:£\e[0m${ip}:${telnetport}" >> .fn_details_ports
- echo -e "\e[34mTelnet password:£\e[0m${telnetpass}" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- fn_details_unreal(){
- fn_check_ip
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
- fn_parms
- fn_details_config
- fn_details_distro
- fn_details_os
- fn_details_performance
- fn_details_disk
- fn_details_gameserver
- fn_details_backup
- fn_details_commandlineparms
- echo -e ""
- echo -e "\e[92mPorts\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "Change ports by editing the parameters in"
- echo -e "${servercfgfullpath}."
- echo -e ""
- echo -e "Useful port diagnostic command:"
- echo -e "netstat -atunp | grep ucc-bin"
- echo -e ""
- echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL£INI VARIABLE" >> .fn_details_ports
- echo -e "> Game£INBOUND£${port}£udp£Port=${port}" >> .fn_details_ports
- echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
- if [ "${engine}" == "unreal" ]; then
- echo -e "< UdpLink Port (random)£OUTBOUND£${udplinkport}+£udp" >> .fn_details_ports
- fi
- if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
- echo -e "> GameSpy query£INBOUND£${gsqueryport}£udp£OldQueryPortNumber=${gsqueryport}" >> .fn_details_ports
- fi
- if [ "${appid}" == "215360" ]; then
- echo -e "< Master server£OUTBOUND£28852£tcp/udp" >> .fn_details_ports
- else
- echo -e "< Master server£OUTBOUND£28900/28902£tcp/udp" >> .fn_details_ports
- fi
- if [ "${appid}" ]; then
- if [ "${appid}" == "223250" ]; then
- echo -e "< Steam£OUTBOUND£20610£udp" >> .fn_details_ports
- else
- echo -e "< Steam£OUTBOUND£20660£udp" >> .fn_details_ports
- fi
- fi
- echo -e "> WebAdmin£INBOUND£${webadminport}£tcp£ListenPort=${webadminport}" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- echo -e ""
- echo -e "\e[92m${servername} WebAdmin\e[0m"
- printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
- echo -e "\e[34mWebAdmin enabled:£\e[0m${webadminenabled}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin user:£\e[0m${webadminuser}" >> .fn_details_ports
- echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
- column -s '£' -t .fn_details_ports
- rm -f .fn_details_ports
- fn_details_statusbottom
- }
- if [ "${engine}" == "avalanche" ]; then
- fn_details_avalanche
- elif [ "${engine}" == "realvirtuality" ]; then
- fn_details_realvirtuality
- elif [ "${engine}" == "seriousengine35" ]; then
- fn_details_seriousengine35
- elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
- fn_details_source
- elif [ "${engine}" == "spark" ]; then
- fn_details_spark
- elif [ "${engine}" == "unity3d" ]; then
- fn_details_unity3d
- elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
- fn_details_unreal
- elif [ "${gamename}" == "Teamspeak 3" ]; then
- fn_details_teamspeak3
- else
- fn_printerrornl "Unable to detect server engine."
- fi
|