Browse Source

Updated functions with best practices

Used http://www.shellcheck.net/ to improve best practices
pull/475/head
Daniel Gibbs 10 years ago
parent
commit
61fca1a5dd
  1. 280
      functions/fn_details
  2. 2
      functions/fn_details_config

280
functions/fn_details

@ -2,7 +2,7 @@
# LGSM fn_details function # LGSM fn_details function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://gameservermanagers.com # Website: http://gameservermanagers.com
# Version: 220715 # Version: 270715
# Description: Displays server infomation. # Description: Displays server infomation.
@ -13,12 +13,14 @@ fn_details_os(){
echo -e "" echo -e ""
echo -e "\e[93mDistro Details\e[0m" echo -e "\e[93mDistro Details\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mDistro:\t\e[0m${os}" >> .fn_details_distro {
echo -e "\e[34mArch:\t\e[0m${arch}" >> .fn_details_distro echo -e "\e[34mDistro:\t\e[0m${os}"
echo -e "\e[34mKernel:\t\e[0m${kernel}" >> .fn_details_distro echo -e "\e[34mArch:\t\e[0m${arch}"
echo -e "\e[34mHostname:\t\e[0m$HOSTNAME" >> .fn_details_distro echo -e "\e[34mKernel:\t\e[0m${kernel}"
echo -e "\e[34mtmux:\t\e[0m${tmuxv}" >> .fn_details_distro echo -e "\e[34mHostname:\t\e[0m$HOSTNAME"
echo -e "\e[34mGLIBC:\t\e[0m${glibcv}" >> .fn_details_distro echo -e "\e[34mtmux:\t\e[0m${tmuxv}"
echo -e "\e[34mGLIBC:\t\e[0m${glibcv}"
} >> .fn_details_distro
column -s $'\t' -t .fn_details_distro column -s $'\t' -t .fn_details_distro
rm -f .fn_details_distro rm -f .fn_details_distro
} }
@ -27,14 +29,18 @@ fn_details_performance(){
echo -e "" echo -e ""
echo -e "\e[93mPerformance\e[0m" echo -e "\e[93mPerformance\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m" >> .fn_details_performance {
echo -e "\e[34mAvg Load:\t\e[0m${load}" >> .fn_details_performance echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m"
echo -e "\e[34mAvg Load:\t\e[0m${load}"
} >> .fn_details_performance
column -s $'\t' -t .fn_details_performance column -s $'\t' -t .fn_details_performance
rm -f .fn_details_performance rm -f .fn_details_performance
echo -e "" echo -e ""
echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m" >> .fn_details_performance {
echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m" >> .fn_details_performance echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m"
echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m" >> .fn_details_performance echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m"
echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m"
} >> .fn_details_performance
column -s $'\t' -t .fn_details_performance column -s $'\t' -t .fn_details_performance
rm -f .fn_details_performance rm -f .fn_details_performance
} }
@ -43,14 +49,16 @@ fn_details_disk(){
echo -e "" echo -e ""
echo -e "\e[93mStorage\e[0m" echo -e "\e[93mStorage\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mFilesystem:\t\e[0m${filesystem}" >> .fn_details_disk {
echo -e "\e[34mTotal:\t\e[0m${totalspace}" >> .fn_details_disk echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
echo -e "\e[34mUsed:\t\e[0m${usedspace}" >> .fn_details_disk echo -e "\e[34mTotal:\t\e[0m${totalspace}"
echo -e "\e[34mAvailable:\t\e[0m${availspace}" >> .fn_details_disk echo -e "\e[34mUsed:\t\e[0m${usedspace}"
echo -e "\e[34mServerfiles:\t\e[0m${serverfilesdu}" >> .fn_details_disk echo -e "\e[34mAvailable:\t\e[0m${availspace}"
echo -e "\e[34mServerfiles:\t\e[0m${serverfilesdu}"
if [ -d "${backupdir}" ]; then if [ -d "${backupdir}" ]; then
echo -e "\e[34mBackups:\t\e[0m${backupdirdu}" >> .fn_details_disk echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
fi fi
} >> .fn_details_disk
column -s $'\t' -t .fn_details_disk column -s $'\t' -t .fn_details_disk
rm -f .fn_details_disk rm -f .fn_details_disk
} }
@ -61,70 +69,70 @@ echo -e ""
## server details ## server details
echo -e "\e[92m${gamename} Server Details\e[0m" echo -e "\e[92m${gamename} Server Details\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
{
# server name # server name
echo -e "\e[34mServer name:\t\e[0m${servername}" >> .fn_details_gameserver echo -e "\e[34mServer name:\t\e[0m${servername}"
# server ip # server ip
echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}" >> .fn_details_gameserver echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}"
# rcon password # rcon password
if [ -n "${rcon}" ]; then if [ -n "${rcon}" ]; then
echo -e "\e[34mRCON password:\t\e[0m${rcon}" >> .fn_details_gameserver echo -e "\e[34mRCON password:\t\e[0m${rcon}"
fi fi
# server password # server password
if [ -n "${serverpassword}" ]; then if [ -n "${serverpassword}" ]; then
echo -e "\e[34mServer password:\t\e[0m${serverpassword}" >> .fn_details_gameserver echo -e "\e[34mServer password:\t\e[0m${serverpassword}"
fi fi
# admin password # admin password
if [ -n "${adminpassword}" ]; then if [ -n "${adminpassword}" ]; then
echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}" >> .fn_details_gameserver echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}"
fi fi
# slots # slots
if [ -n "${slots}" ]; then if [ -n "${slots}" ]; then
echo -e "\e[34mSlots:\t\e[0m${slots}" >> .fn_details_gameserver echo -e "\e[34mSlots:\t\e[0m${slots}"
fi fi
# game mode # game mode
if [ -n "${gamemode}" ]; then if [ -n "${gamemode}" ]; then
echo -e "\e[34mGame mode:\t\e[0m${gamemode}" >> .fn_details_gameserver echo -e "\e[34mGame mode:\t\e[0m${gamemode}"
fi fi
# game world # game world
if [ -n "${gameworld}" ]; then if [ -n "${gameworld}" ]; then
echo -e "\e[34mGame world:\t\e[0m${gameworld}" >> .fn_details_gameserver echo -e "\e[34mGame world:\t\e[0m${gameworld}"
fi fi
# tick rate # tick rate
if [ -n "${tickrate}" ]; then if [ -n "${tickrate}" ]; then
echo -e "\e[34mTick rate:\t\e[0m${tickrate}" >> .fn_details_gameserver echo -e "\e[34mTick rate:\t\e[0m${tickrate}"
fi fi
# online status # online status
if [ "${gamename}" == "Teamspeak 3" ]; then if [ "${gamename}" == "Teamspeak 3" ]; then
fn_check_ts3status fn_check_ts3status
if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
else else
echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m" >> .fn_details_gameserver echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
fi fi
else else
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
if [ "${pid}" == "0" ]; then if [ "${pid}" == "0" ]; then
echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
else else
echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m" >> .fn_details_gameserver echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
fi fi
fi fi
# teamspeak dbplugin # teamspeak dbplugin
if [ -n "${dbplugin}" ]; then if [ -n "${dbplugin}" ]; then
echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}" >> .fn_details_gameserver echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}"
fi fi
} >> .fn_details_gameserver
column -s $'\t' -t .fn_details_gameserver column -s $'\t' -t .fn_details_gameserver
rm -f .fn_details_gameserver rm -f .fn_details_gameserver
echo -e "" echo -e ""
@ -132,54 +140,54 @@ echo -e ""
## script details ## script details
echo -e "\e[92m${selfname} Script Details\e[0m" echo -e "\e[92m${selfname} Script Details\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
{
# service name # service name
echo -e "\e[34mService name:\t\e[0m${servicename}" >> .fn_details_gameserver echo -e "\e[34mService name:\t\e[0m${servicename}"
# script version # script version
if [ -n "${version}" ]; then if [ -n "${version}" ]; then
echo -e "\e[34m${selfname} version:\t\e[0m${version}" >> .fn_details_gameserver echo -e "\e[34m${selfname} version:\t\e[0m${version}"
fi fi
# script user # script user
echo -e "\e[34mUser:\t\e[0m$(whoami)" >> .fn_details_gameserver echo -e "\e[34mUser:\t\e[0m$(whoami)"
# GLIBC required # GLIBC required
if [ -n "${glibcrequired}" ]; then if [ -n "${glibcrequired}" ]; then
if [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt "$(echo "${glibcrequired}" | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" ]; then if [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt "$(echo "${glibcrequired}" | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" ]; then
if [ "${glibcfix}" == "yes" ]; then if [ "${glibcfix}" == "yes" ]; then
echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)" >> .fn_details_gameserver echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)"
else else
echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}\e[0m(\e[0;32mGLIBC version too old\e[0m)" >> .fn_details_gameserver echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}\e[0m(\e[0;32mGLIBC version too old\e[0m)"
fi fi
else else
echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m" >> .fn_details_gameserver echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m"
fi fi
fi fi
# email notification # email notification
if [ -n "${emailnotification}" ]; then if [ -n "${emailnotification}" ]; then
echo -e "\e[34mEmail notification:\t\e[0m${emailnotification}" >> .fn_details_gameserver echo -e "\e[34mEmail notification:\t\e[0m${emailnotification}"
fi fi
# update on start # update on start
if [ -n "${updateonstart}" ]; then if [ -n "${updateonstart}" ]; then
echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}" >> .fn_details_gameserver echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}"
fi fi
# script location # script location
echo -e "\e[34mLocation:\t\e[0m${rootdir}" >> .fn_details_gameserver echo -e "\e[34mLocation:\t\e[0m${rootdir}"
# config file location # config file location
if [ -n "${servercfgfullpath}" ]; then if [ -n "${servercfgfullpath}" ]; then
echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}" >> .fn_details_gameserver echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}"
fi fi
# network config file location (ARMA 3) # network config file location (ARMA 3)
if [ -n "${networkcfgfullpath}" ]; then if [ -n "${networkcfgfullpath}" ]; then
echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}" >> .fn_details_gameserver echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}"
fi fi
} >> .fn_details_script
column -s $'\t' -t .fn_details_gameserver column -s $'\t' -t .fn_details_gameserver
rm -f .fn_details_gameserver rm -f .fn_details_gameserver
} }
@ -191,11 +199,13 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then
echo -e "No Backups created" echo -e "No Backups created"
else else
echo -e "\e[34mNo. of backups:\t\e[0m${backupcount}" >> .fn_details_backup {
echo -e "\e[34mLatest backup:\e[0m" >> .fn_details_backup echo -e "\e[34mNo. of backups:\t\e[0m${backupcount}"
echo -e "\e[34m date:\t\e[0m${lastbackupdate}" >> .fn_details_backup echo -e "\e[34mLatest backup:\e[0m"
echo -e "\e[34m file:\t\e[0m${lastbackup}" >> .fn_details_backup echo -e "\e[34m date:\t\e[0m${lastbackupdate}"
echo -e "\e[34m size:\t\e[0m${lastbackupsize}" >> .fn_details_backup echo -e "\e[34m file:\t\e[0m${lastbackup}"
echo -e "\e[34m size:\t\e[0m${lastbackupsize}"
} >> .fn_details_backup
column -s $'\t' -t .fn_details_backup column -s $'\t' -t .fn_details_backup
rm -f .fn_details_backup rm -f .fn_details_backup
fi fi
@ -237,7 +247,7 @@ fn_details_performance
fn_details_disk fn_details_disk
fn_details_gameserver fn_details_gameserver
fn_details_backup fn_details_backup
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
echo -e "" echo -e ""
echo -e "\e[92mPorts\e[0m" echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
@ -247,8 +257,10 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep Jcmp-Server" echo -e "netstat -atunp | grep Jcmp-Server"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tINBOUND\t${port}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -263,7 +275,7 @@ fn_details_performance
fn_details_disk fn_details_disk
fn_details_gameserver fn_details_gameserver
fn_details_backup fn_details_backup
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
echo -e "" echo -e ""
echo -e "\e[92mPorts\e[0m" echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
@ -273,8 +285,10 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep dontstarve" echo -e "netstat -atunp | grep dontstarve"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tINBOUND\t${port}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -289,7 +303,7 @@ fn_details_performance
fn_details_disk fn_details_disk
fn_details_gameserver fn_details_gameserver
fn_details_backup fn_details_backup
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
echo -e "" echo -e ""
echo -e "\e[92mPorts\e[0m" echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
@ -299,8 +313,10 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep java" echo -e "netstat -atunp | grep java"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tINBOUND\t${port}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -309,7 +325,7 @@ fn_details_statusbottom
fn_details_realvirtuality(){ fn_details_realvirtuality(){
fn_check_ip fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fn_parms fn_parms
fn_details_config fn_details_config
fn_details_distro fn_details_distro
@ -328,14 +344,16 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep arma3server" echo -e "netstat -atunp | grep arma3server"
echo -e "" echo -e ""
if [ -z ${port} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then if [ -z "${port}" ] || [ -z "${queryport}" ] || [ -z "${masterport}" ]; then
echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}." echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
echo -e "" echo -e ""
fi fi
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp" >> .fn_details_ports echo -e "> Game\tINBOUND\t${port}\tudp"
echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp" >> .fn_details_ports echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -343,7 +361,7 @@ fn_details_statusbottom
fn_details_seriousengine35(){ fn_details_seriousengine35(){
fn_check_ip fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fn_parms fn_parms
fn_details_config fn_details_config
fn_details_distro fn_details_distro
@ -362,9 +380,11 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep Sam3_Dedicate" echo -e "netstat -atunp | grep Sam3_Dedicate"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game/RCON\tINBOUND\t${port}\ttcp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Query\tINBOUND\t${queryport}\tudp" >> .fn_details_ports echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
echo -e "> Query\tINBOUND\t${queryport}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -390,12 +410,14 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep srcds_linux" echo -e "netstat -atunp | grep srcds_linux"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
if [ -n "${sourcetvport}" ]; then if [ -n "${sourcetvport}" ]; then
echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp" >> .fn_details_ports echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
fi fi
echo -e "< Client\tOUTBOUND\t${clientport}\tudp" >> .fn_details_ports echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -403,7 +425,7 @@ fn_details_statusbottom
fn_details_spark(){ fn_details_spark(){
fn_check_ip fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fn_parms fn_parms
fn_details_config fn_details_config
fn_details_distro fn_details_distro
@ -422,18 +444,22 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep server_linux3" echo -e "netstat -atunp | grep server_linux3"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game/RCON\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Query\tINBOUND\t${queryport}\tudp" >> .fn_details_ports echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp" >> .fn_details_ports echo -e "> Query\tINBOUND\t${queryport}\tudp"
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
echo -e "" echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m" echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}/index.html" >> .fn_details_ports {
echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}" >> .fn_details_ports echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}/index.html"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}" >> .fn_details_ports echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -459,10 +485,12 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep starbound" echo -e "netstat -atunp | grep starbound"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\ttcp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Query\tINBOUND\t${queryport}\ttcp" >> .fn_details_ports echo -e "> Game\tINBOUND\t${port}\ttcp"
echo -e "> Rcon\tINBOUND\t${rconport}\ttcp" >> .fn_details_ports echo -e "> Query\tINBOUND\t${queryport}\ttcp"
echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -487,10 +515,12 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep ts3server" echo -e "netstat -atunp | grep ts3server"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Voice\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp" >> .fn_details_ports echo -e "> Voice\tINBOUND\t${port}\tudp"
echo -e "> File transfer\tINBOUND\t${fileport}\ttcp" >> .fn_details_ports echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -498,7 +528,7 @@ fn_details_statusbottom
fn_details_unity3d(){ fn_details_unity3d(){
fn_check_ip fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fn_parms fn_parms
fn_details_config fn_details_config
fn_details_distro fn_details_distro
@ -517,27 +547,33 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep 7DaysToDie" echo -e "netstat -atunp | grep 7DaysToDie"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" >> .fn_details_ports {
echo -e "> Game/RCON\tINBOUND\t${port}\tudp" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Query\tINBOUND\t${queryport}\tudp" >> .fn_details_ports echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp" >> .fn_details_ports echo -e "> Query\tINBOUND\t${queryport}\tudp"
echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp" >> .fn_details_ports echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
echo -e "" echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m" echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}" >> .fn_details_ports {
echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}" >> .fn_details_ports echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
echo -e "" echo -e ""
echo -e "\e[92m${servername} Telnet\e[0m" echo -e "\e[92m${servername} Telnet\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mTelnet enabled:\t\e[0m${telnetenabled}" >> .fn_details_ports {
echo -e "\e[34mTelnet address:\t\e[0m${ip} ${telnetport}" >> .fn_details_ports echo -e "\e[34mTelnet enabled:\t\e[0m${telnetenabled}"
echo -e "\e[34mTelnet password:\t\e[0m${telnetpass}" >> .fn_details_ports echo -e "\e[34mTelnet address:\t\e[0m${ip} ${telnetport}"
echo -e "\e[34mTelnet password:\t\e[0m${telnetpass}"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
@ -545,7 +581,7 @@ fn_details_statusbottom
fn_details_unreal(){ fn_details_unreal(){
fn_check_ip fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l) pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
fn_parms fn_parms
fn_details_config fn_details_config
fn_details_distro fn_details_distro
@ -564,43 +600,47 @@ echo -e ""
echo -e "Useful port diagnostic command:" echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep ucc-bin" echo -e "netstat -atunp | grep ucc-bin"
echo -e "" echo -e ""
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE" >> .fn_details_ports {
echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}" >> .fn_details_ports echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
echo -e "> Query\tINBOUND\t${queryport}\tudp" >> .fn_details_ports echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
echo -e "> Query\tINBOUND\t${queryport}\tudp"
if [ "${engine}" == "unreal" ]; then if [ "${engine}" == "unreal" ]; then
echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp" >> .fn_details_ports echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
fi fi
if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}" >> .fn_details_ports echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
fi fi
if [ "${appid}" == "215360" ]; then if [ "${appid}" == "215360" ]; then
echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp" >> .fn_details_ports echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
else else
echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp" >> .fn_details_ports echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
fi fi
if [ "${appid}" ]; then if [ "${appid}" ]; then
if [ "${appid}" == "223250" ]; then if [ "${appid}" == "223250" ]; then
echo -e "< Steam\tOUTBOUND\t20610\tudp" >> .fn_details_ports echo -e "< Steam\tOUTBOUND\t20610\tudp"
else else
echo -e "< Steam\tOUTBOUND\t20660\tudp" >> .fn_details_ports echo -e "< Steam\tOUTBOUND\t20660\tudp"
fi fi
fi fi
echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}" >> .fn_details_ports echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
echo -e "" echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m" echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}" >> .fn_details_ports {
echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
echo -e "\e[34mWebAdmin user:\t\e[0m${webadminuser}" >> .fn_details_ports echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}" >> .fn_details_ports echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
} >> .fn_details_ports
column -s $'\t' -t .fn_details_ports column -s $'\t' -t .fn_details_ports
rm -f .fn_details_ports rm -f .fn_details_ports
fn_details_statusbottom fn_details_statusbottom
} }
if [ ! -e ${servercfgfullpath} ]; then if [ ! -e "${servercfgfullpath}" ]; then
echo "" echo ""
fn_printwarnnl "\e[0;31mCONFIGURATION FILE MISSING!\e[0m" fn_printwarnnl "\e[0;31mCONFIGURATION FILE MISSING!\e[0m"
echo "${servercfgfullpath}" echo "${servercfgfullpath}"

2
functions/fn_details_config

@ -2,7 +2,7 @@
# LGSM fn_details_config function # LGSM fn_details_config function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://gameservermanagers.com # Website: http://gameservermanagers.com
# Version: 250715 # Version: 270715
# Description: Gets specific details from config files. # Description: Gets specific details from config files.

Loading…
Cancel
Save