From fe5257ca76d5399b327c3c51e7fe244290a1f1cc Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Tue, 13 Oct 2015 22:19:08 +1300 Subject: [PATCH 1/4] Add teeworlds server script --- Teeworlds/twserver | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Teeworlds/twserver diff --git a/Teeworlds/twserver b/Teeworlds/twserver new file mode 100644 index 000000000..b78a93f62 --- /dev/null +++ b/Teeworlds/twserver @@ -0,0 +1,92 @@ +#!/bin/bash +# Terraria +# Server Management Script +# Author: Daniel Gibbs +# Contributor: Bryce Van Dyk (SingingTree) +# Website: http://gameservermanagers.com +version="071015" + +#### Variables #### + +# Notification Email +# (on|off) +emailnotification="off" +email="email@example.com" + +# Steam login +steamuser="username" +steampass="password" + +# Start Variables +ip="0.0.0.0" +updateonstart="off" + +fn_parms(){ +parms="-f ${servercfgfullpath}" +} + +#### Advanced Variables #### + +# Steam +appid="380840" + +# Server Details +servicename="tw-server" +gamename="Teeworlds" +engine="teeworlds" + +# Directories +rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" +filesdir="${rootdir}/serverfiles" +systemdir="${filesdir}" +executabledir="${filesdir}" +executable="./teeworlds_srv" +servercfg="${servicename}.cfg" # Teeworlds can also auto load any config if an autoexec.cfg file is present in the server dir +servercfgdir="${filesdir}" +servercfgfullpath="${servercfgdir}/${servercfg}" +backupdir="${rootdir}/backups" + +# Logging +logdays="7" +#gamelogdir="" # Teeworlds has a configurable logfile location, use 'logfile' in server.cfg +scriptlogdir="${rootdir}/log/script" +consolelogdir="${rootdir}/log/console" + +scriptlog="${scriptlogdir}/${servicename}-script.log" +consolelog="${consolelogdir}/${servicename}-console.log" +emaillog="${scriptlogdir}/${servicename}-email.log" + +scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log" +consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log" + +##### Script ##### +# Do not edit + +fn_runfunction(){ +# Functions are downloaded and run with this function +if [ ! -f "${rootdir}/functions/${functionfile}" ]; then + cd "${rootdir}" + if [ ! -d "functions" ]; then + mkdir functions + fi + cd functions + echo -e " loading ${functionfile}...\c" + wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45- + chmod +x "${functionfile}" + cd "${rootdir}" +fi +source "${rootdir}/functions/${functionfile}" +} + +fn_functions(){ +# Functions are defined in fn_functions. +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_functions + +getopt=$1 +fn_getopt From 6087cbd46fc8f10c9920f6899c003dde420322c6 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Wed, 14 Oct 2015 20:55:39 +1300 Subject: [PATCH 2/4] Update details for teeworlds --- Teeworlds/twserver | 2 +- functions/fn_details | 52 +++++++++++++++++++++++++++++-------- functions/fn_details_config | 12 ++++++++- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/Teeworlds/twserver b/Teeworlds/twserver index b78a93f62..b8b0e3dba 100644 --- a/Teeworlds/twserver +++ b/Teeworlds/twserver @@ -4,7 +4,7 @@ # Author: Daniel Gibbs # Contributor: Bryce Van Dyk (SingingTree) # Website: http://gameservermanagers.com -version="071015" +version="141015" #### Variables #### diff --git a/functions/fn_details b/functions/fn_details index 3463272a2..b240af2a5 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -497,7 +497,36 @@ fn_details_statusbottom } -fn_details_terraria(){ +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 parameters in" +echo -e "${servercfgfullpath}." +echo -e "" +echo -e "Useful port diagnostic command:" +echo -e "netstat -atunp | grep ts3server" +echo -e "" +{ + 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 +} + +fn_details_teeworlds(){ fn_check_ip fn_parms fn_details_config @@ -520,16 +549,15 @@ echo -e "" { 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 - } -fn_details_teamspeak3(){ +fn_details_terraria(){ +fn_check_ip +fn_parms fn_details_config fn_details_distro fn_details_os @@ -541,17 +569,17 @@ 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 "Change ports by editing the command-line" +echo -e "parameters in ${servercfgfullpath}." echo -e "" echo -e "Useful port diagnostic command:" -echo -e "netstat -atunp | grep ts3server" +echo -e "netstat -atunp | grep terraia" echo -e "" { 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" + 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 @@ -735,6 +763,8 @@ elif [ "${engine}" == "spark" ]; then fn_details_spark elif [ "${engine}" == "starbound" ]; then fn_details_starbound +elif [ "${engine}" == "teeworlds" ]; then + fn_details_teeworlds elif [ "${engine}" == "terraria" ]; then fn_details_terraria elif [ "${engine}" == "unity3d" ]; then diff --git a/functions/fn_details_config b/functions/fn_details_config index c85ea2316..1948b5196 100644 --- a/functions/fn_details_config +++ b/functions/fn_details_config @@ -382,6 +382,16 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then fileport="30033" fi +elif [ "${gamename}" == "Teeworlds" ]; then + + # port + if [ -f "${servercfgfullpath}" ]; then + port=$(grep "DefaultPort=" "${servercfgfullpath}" | tr -cd "[:digit:]") + fi + if [ ! -n "${port}" ]; then + port="0" + fi + elif [ "${engine}" == "unity3d" ]; then # server name @@ -502,7 +512,7 @@ elif [ "${engine}" == "unity3d" ]; then # port if [ -f "${servercfgfullpath}" ]; then - port=$(grep "ServerPort" "${servercfgfullpath}" | tr -cd "[:digit:]") + port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd "[:digit:]") fi if [ ! -n "${port}" ]; then port="0" From 6655fd1aa44e21f8601b2abb4482affab447f411 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Wed, 14 Oct 2015 20:59:49 +1300 Subject: [PATCH 3/4] Update a couple of dates in comments --- functions/fn_details | 2 +- functions/fn_details_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fn_details b/functions/fn_details index b240af2a5..a6175744c 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -2,7 +2,7 @@ # LGSM fn_details function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 070915 +# Version: 141015 # Description: Displays server infomation. diff --git a/functions/fn_details_config b/functions/fn_details_config index 1948b5196..098b40a29 100644 --- a/functions/fn_details_config +++ b/functions/fn_details_config @@ -2,7 +2,7 @@ # LGSM fn_details_config function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 090815 +# Version: 141015 # Description: Gets specific details from config files. From ae0a337477228836fd8ca871ada08722bcd611ed Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Wed, 14 Oct 2015 21:09:02 +1300 Subject: [PATCH 4/4] Use teeworlds engine name in fn_details_config Use the engine name instead of the game name as its more consistent with the rest of the checks done --- functions/fn_details_config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fn_details_config b/functions/fn_details_config index 098b40a29..89e600aaa 100644 --- a/functions/fn_details_config +++ b/functions/fn_details_config @@ -382,7 +382,7 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then fileport="30033" fi -elif [ "${gamename}" == "Teeworlds" ]; then +elif [ "${engine}" == "teeworlds" ]; then # port if [ -f "${servercfgfullpath}" ]; then