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. 436
      functions/fn_details
  2. 124
      functions/fn_details_config

436
functions/fn_details

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

124
functions/fn_details_config

@ -2,7 +2,7 @@
# LGSM fn_details_config function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
# Version: 250715
# Version: 270715
# Description: Gets specific details from config files.
@ -23,7 +23,7 @@ if [ "${engine}" == "avalanche" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "Name" "${servercfgfullpath}"|sed 's/Name//g'|tr -d '=", \n')
servername=$(grep "Name" "${servercfgfullpath}" | sed 's/Name//g' | tr -d '=", \n')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -34,15 +34,15 @@ if [ "${engine}" == "avalanche" ]; then
# ip
if [ -f "${servercfgfullpath}" ]; then
# check if the ip exists in the config file. Failing this will fall back to the default.
configipcheck=$(grep "BindIP" "${servercfgfullpath}"|sed 's/BindIP//g'|tr -d '=", \n')
configipcheck=$(grep "BindIP" "${servercfgfullpath}" | sed 's/BindIP//g' | tr -d '=", \n')
fi
if [ -n "${configipcheck}" ]; then
ip=$(grep "BindIP" "${servercfgfullpath}"|sed 's/BindIP//g'|tr -d '=", \n')
ip=$(grep "BindIP" "${servercfgfullpath}" | sed 's/BindIP//g' | tr -d '=", \n')
fi
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "Password" "${servercfgfullpath}"|sed 's/Password//g'|tr -d '=", \n')
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed 's/Password//g' | tr -d '=", \n')
if [ ! -n "${serverpassword}" ]; then
serverpassword="NOT SET"
fi
@ -52,7 +52,7 @@ if [ "${engine}" == "avalanche" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "MaxPlayers" "${servercfgfullpath}"|tr -cd "[:digit:]")
slots=$(grep "MaxPlayers" "${servercfgfullpath}" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -62,7 +62,7 @@ if [ "${engine}" == "avalanche" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "BindPort" "${servercfgfullpath}"|tr -cd "[:digit:]")
port=$(grep "BindPort" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -75,7 +75,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "default_server_name = " "${servercfgfullpath}"|sed 's/default_server_name = //g')
servername=$(grep "default_server_name = " "${servercfgfullpath}" | sed 's/default_server_name = //g')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -85,7 +85,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "server_password = " "${servercfgfullpath}"|grep -v "#"|sed 's/server_password = //g')
serverpassword=$(grep "server_password = " "${servercfgfullpath}" | grep -v "#" | sed 's/server_password = //g')
if [ ! -n "${serverpassword}" ]; then
serverpassword="NOT SET"
fi
@ -95,7 +95,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "max_players" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
slots=$(grep "max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -105,7 +105,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# game mode
if [ -f "${servercfgfullpath}" ]; then
gamemode=$(grep "game_mode = " "${servercfgfullpath}"|grep -v "#"|sed 's/game_mode = //g')
gamemode=$(grep "game_mode = " "${servercfgfullpath}" | grep -v "#" | sed 's/game_mode = //g')
if [ ! -n "${gamemode}" ]; then
gamemode="NOT SET"
fi
@ -115,7 +115,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# tickrate
if [ -f "${servercfgfullpath}" ]; then
tickrate=$(grep "tick_rate" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
tickrate=$(grep "tick_rate" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${tickrate}" ]; then
tickrate="NOT SET"
fi
@ -125,7 +125,7 @@ elif [ "${engine}" == "dontstarve" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "server_port" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -138,7 +138,7 @@ elif [ "${engine}" == "projectzomboid" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "PublicName=" "${servercfgfullpath}"|sed 's/PublicName=//g'|tr -d '=", \n')
servername=$(grep "PublicName=" "${servercfgfullpath}" | sed 's/PublicName=//g' | tr -d '=", \n')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -148,7 +148,7 @@ elif [ "${engine}" == "projectzomboid" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "MaxPlayers=" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
slots=$(grep "MaxPlayers=" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -158,7 +158,7 @@ elif [ "${engine}" == "projectzomboid" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "DefaultPort=" "${servercfgfullpath}"|tr -cd "[:digit:]")
port=$(grep "DefaultPort=" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -170,7 +170,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "hostname" "${servercfgfullpath}"|grep -v "//"|sed -e 's/\<hostname\>//g'|tr -d '=\"; ')
servername=$(grep "hostname" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\<hostname\>//g' | tr -d '=\"; ')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -180,7 +180,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# admin password
if [ -f "${servercfgfullpath}" ]; then
adminpassword=$(grep "password =" "${servercfgfullpath}"|grep -v "//"|sed -e 's/\password//g'|tr -d '=\"; ')
adminpassword=$(grep "password =" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\password//g' | tr -d '=\"; ')
if [ ! -n "${adminpassword}" ]; then
adminpassword="NOT SET"
fi
@ -190,7 +190,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "passwordAdmin" "${servercfgfullpath}"|grep -v "//"|sed -e 's/\passwordAdmin//g'|tr -d '=\"; ')
serverpassword=$(grep "passwordAdmin" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\passwordAdmin//g' | tr -d '=\"; ')
if [ ! -n "${adminpassword}" ]; then
serverpassword="NOT SET"
fi
@ -200,7 +200,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "maxPlayers" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
slots=$(grep "maxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -210,7 +210,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "serverport=" "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd "[:digit:]")
port=$(grep "serverport=" "${servercfgfullpath}" | grep -v // | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -218,7 +218,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# query port
if [ -f "${servercfgfullpath}" ]; then
queryport=$(grep "steamqueryport=" "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd "[:digit:]")
queryport=$(grep "steamqueryport=" "${servercfgfullpath}" | grep -v // | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${queryport}" ]; then
queryport="0"
@ -226,7 +226,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
# master port
if [ -f "${servercfgfullpath}" ]; then
masterport=$(grep "steamport=" "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd "[:digit:]")
masterport=$(grep "steamport=" "${servercfgfullpath}" | grep -v // | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${masterport}" ]; then
masterport="0"
@ -238,7 +238,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|tr -d '=\"; ')
servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}" | sed 's/prj_strMultiplayerSessionName = //g' | tr -d '=\"; ')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -248,7 +248,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
# rcon password
if [ -f "${servercfgfullpath}" ]; then
rcon=$(grep "rcts_strAdminPassword" "${servercfgfullpath}"|sed 's/rcts_strAdminPassword = //g'|tr -d '=\"; ')
rcon=$(grep "rcts_strAdminPassword" "${servercfgfullpath}" | sed 's/rcts_strAdminPassword = //g' | tr -d '=\"; ')
if [ ! -n "${rcon}" ]; then
rcon="NOT SET"
fi
@ -258,7 +258,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -268,7 +268,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
# game mode
if [ -f "${servercfgfullpath}" ]; then
gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}"|grep -v "#"|sed 's/gam_idGameMode//g'|tr -d '=\"; ')
gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}" | grep -v "#" | sed 's/gam_idGameMode//g' | tr -d '=\"; ')
if [ ! -n "${gamemode}" ]; then
gamemode="NOT SET"
fi
@ -278,7 +278,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "prj_uwPort" "${servercfgfullpath}"|tr -d '\r'|tr -cd "[:digit:]")
port=$(grep "prj_uwPort" "${servercfgfullpath}" | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -298,7 +298,7 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "hostname" "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
servername=$(grep "hostname" "${servercfgfullpath}" | sed 's/hostname //g' | sed 's/"//g')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -308,7 +308,7 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "sv_password" "${servercfgfullpath}"|sed 's/sv_password//g'|sed 's/"//g')
serverpassword=$(grep "sv_password" "${servercfgfullpath}" | sed 's/sv_password//g' | sed 's/"//g')
if [ ! -n "${serverpassword}" ]; then
serverpassword="NOT SET"
fi
@ -318,7 +318,7 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
# rcon password
if [ -f "${servercfgfullpath}" ]; then
rcon=$(grep "rcon_password" "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
rcon=$(grep "rcon_password" "${servercfgfullpath}" | sed 's/rcon_password //g' | sed 's/"//g')
if [ ! -n "${rcon}" ]; then
rcon="NOT SET"
fi
@ -328,7 +328,7 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}"|grep -v "#"|tr -cd "[:digit:]")
slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -351,15 +351,15 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
# ip
if [ -f "${servercfgfullpath}" ]; then
# check if the ip exists in the config file. Failing this will fall back to the default.
configipcheck=$(grep "voice_ip=" "${servercfgfullpath}"|sed 's/\voice_ip=//g')
configipcheck=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/\voice_ip=//g')
fi
if [ -n "${configipcheck}" ]; then
ip=$(grep "voice_ip=" "${servercfgfullpath}"|sed 's/\voice_ip=//g')
ip=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/\voice_ip=//g')
fi
# dbplugin
if [ -f "${servercfgfullpath}" ]; then
dbplugin=$(grep "dbplugin=" "${servercfgfullpath}"|sed 's/\dbplugin=//g')
dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed 's/\dbplugin=//g')
if [ ! -n "${serverpassword}" ]; then
dbplugin="NOT SET"
fi
@ -369,7 +369,7 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "default_voice_port=" "${servercfgfullpath}"|tr -cd "[:digit:]")
port=$(grep "default_voice_port=" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="9987"
@ -377,7 +377,7 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
# query port
if [ -f "${servercfgfullpath}" ]; then
queryport=$(grep "query_port=" "${servercfgfullpath}"|tr -cd "[:digit:]")
queryport=$(grep "query_port=" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${queryport}" ]; then
queryport="10011"
@ -385,7 +385,7 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
# fileport port
if [ -f "${servercfgfullpath}" ]; then
fileport=$(grep "filetransfer_port=" "${servercfgfullpath}"|tr -cd "[:digit:]")
fileport=$(grep "filetransfer_port=" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${fileport}" ]; then
fileport="30033"
@ -395,7 +395,7 @@ elif [ "${engine}" == "unity3d" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "ServerName" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -405,7 +405,7 @@ elif [ "${engine}" == "unity3d" ]; then
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "ServerPassword" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${serverpassword}" ]; then
serverpassword="NOT SET"
fi
@ -415,7 +415,7 @@ elif [ "${engine}" == "unity3d" ]; then
# webadmin enabled
if [ -f "${servercfgfullpath}" ]; then
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${webadminenabled}" ]; then
webadminenabled="NOT SET"
fi
@ -425,7 +425,7 @@ elif [ "${engine}" == "unity3d" ]; then
# webadmin port
if [ -f "${servercfgfullpath}" ]; then
webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}"|tr -cd "[:digit:]")
webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${webadminport}" ]; then
webadminport="0"
@ -433,7 +433,7 @@ elif [ "${engine}" == "unity3d" ]; then
# webadmin enabled
if [ -f "${servercfgfullpath}" ]; then
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${webadminenabled}" ]; then
webadminenabled="NOT SET"
fi
@ -443,7 +443,7 @@ elif [ "${engine}" == "unity3d" ]; then
# webadmin password
if [ -f "${servercfgfullpath}" ]; then
webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${webadminpass}" ]; then
webadminpass="NOT SET"
fi
@ -453,7 +453,7 @@ elif [ "${engine}" == "unity3d" ]; then
# telnet enabled
if [ -f "${servercfgfullpath}" ]; then
telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${telnetenabled}" ]; then
telnetenabled="NOT SET"
fi
@ -463,7 +463,7 @@ elif [ "${engine}" == "unity3d" ]; then
# telnet port
if [ -f "${servercfgfullpath}" ]; then
telnetport=$(grep "TelnetPort" "${servercfgfullpath}"|tr -cd "[:digit:]")
telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${telnetport}" ]; then
telnetport="0"
@ -471,7 +471,7 @@ elif [ "${engine}" == "unity3d" ]; then
# telnet password
if [ -f "${servercfgfullpath}" ]; then
telnetpass=$(grep "TelnetEnabled" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
telnetpass=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${telnetenabled}" ]; then
telnetpass="NOT SET"
fi
@ -481,7 +481,7 @@ elif [ "${engine}" == "unity3d" ]; then
# slots
if [ -f "${servercfgfullpath}" ]; then
slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}"|tr -cd "[:digit:]")
slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd "[:digit:]")
if [ ! -n "${slots}" ]; then
slots="NOT SET"
fi
@ -491,7 +491,7 @@ elif [ "${engine}" == "unity3d" ]; then
# game mode
if [ -f "${servercfgfullpath}" ]; then
gamemode=$(grep "GameMode" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${gamemode}" ]; then
gamemode="NOT SET"
fi
@ -501,7 +501,7 @@ elif [ "${engine}" == "unity3d" ]; then
# game world
if [ -f "${servercfgfullpath}" ]; then
gameworld=$(grep "GameWorld" "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
if [ ! -n "${gameworld}" ]; then
gameworld="NOT SET"
fi
@ -511,7 +511,7 @@ elif [ "${engine}" == "unity3d" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "ServerPort" "${servercfgfullpath}"|tr -cd "[:digit:]")
port=$(grep "ServerPort" "${servercfgfullpath}" | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -529,7 +529,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# server name
if [ -f "${servercfgfullpath}" ]; then
servername=$(grep "ServerName=" "${servercfgfullpath}"|sed 's/ServerName=//g')
servername=$(grep "ServerName=" "${servercfgfullpath}" | sed 's/ServerName=//g')
if [ ! -n "${servername}" ]; then
servername="NOT SET"
fi
@ -539,7 +539,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# server password
if [ -f "${servercfgfullpath}" ]; then
serverpassword=$(grep "GamePassword=" "${servercfgfullpath}"|sed 's/GamePassword=//g')
serverpassword=$(grep "GamePassword=" "${servercfgfullpath}" | sed 's/GamePassword=//g')
if [ ! -n "${serverpassword}" ]; then
serverpassword="NOT SET"
fi
@ -549,7 +549,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# admin password
if [ -f "${servercfgfullpath}" ]; then
adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}"|sed 's/AdminPassword=//g')
adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/AdminPassword=//g')
if [ ! -n "${adminpassword}" ]; then
adminpassword="NOT SET"
fi
@ -559,7 +559,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# port
if [ -f "${servercfgfullpath}" ]; then
port=$(grep "Port=" "${servercfgfullpath}"|grep -v "Master"|grep -v "LAN"|grep -v "Proxy"|grep -v "Listen"|tr -d '\r'|tr -cd "[:digit:]")
port=$(grep "Port=" "${servercfgfullpath}" | grep -v "Master" | grep -v "LAN" | grep -v "Proxy" | grep -v "Listen" | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${port}" ]; then
port="0"
@ -575,7 +575,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# gamespy query port
if [ -f "${servercfgfullpath}" ]; then
gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}"|tr -d '\r'|tr -cd "[:digit:]")
gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}" | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${gsqueryport}" ]; then
gsqueryport="0"
@ -591,7 +591,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin enabled
if [ -f "${servercfgfullpath}" ]; then
webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}"|sed 's/bEnabled=//g'|tr -d '\r')
webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}" | sed 's/bEnabled=//g' | tr -d '\r')
if [ ! -n "${webadminenabled}" ]; then
webadminenabled="NOT SET"
fi
@ -601,7 +601,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin port
if [ -f "${servercfgfullpath}" ]; then
webadminport=$(grep "ListenPort=" "${servercfgfullpath}"|tr -d '\r'|tr -cd "[:digit:]")
webadminport=$(grep "ListenPort=" "${servercfgfullpath}" | tr -d '\r' | tr -cd "[:digit:]")
fi
if [ ! -n "${webadminport}" ]; then
webadminport="0"
@ -611,7 +611,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin user
if [ -f "${servercfgfullpath}" ]; then
webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}"|sed 's/\AdminUsername=//g')
webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}" | sed 's/\AdminUsername=//g')
if [ ! -n "${webadminuser}" ]; then
webadminuser="NOT SET"
fi
@ -621,7 +621,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin password
if [ -f "${servercfgfullpath}" ]; then
webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2|grep "AdminPassword="|sed 's/\AdminPassword=//g')
webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2 | grep "AdminPassword=" | sed 's/\AdminPassword=//g')
if [ ! -n "${webadminpass}" ]; then
webadminpass="NOT SET"
fi
@ -633,7 +633,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin user
if [ -f "${servercfgfullpath}" ]; then
webadminuser=$(grep "AdminName=" "${servercfgfullpath}"|sed 's/\AdminName=//g')
webadminuser=$(grep "AdminName=" "${servercfgfullpath}" | sed 's/\AdminName=//g')
if [ ! -n "${webadminuser}" ]; then
webadminuser="NOT SET"
fi
@ -643,7 +643,7 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
# webadmin password
if [ -f "${servercfgfullpath}" ]; then
webadminpass=$(grep "AdminPassword=" "${servercfgfullpath}"|sed 's/\AdminPassword=//g')
webadminpass=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/\AdminPassword=//g')
if [ ! -n "${webadminpass}" ]; then
webadminpass="NOT SET"
fi

Loading…
Cancel
Save