From 3343790d9de62e34712a3d18ac7539f44d73f735 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 20:33:36 +1200 Subject: [PATCH 1/8] First run at Terraia script --- Terraria/terrariaserver | 92 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Terraria/terrariaserver diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver new file mode 100644 index 000000000..80d9867d3 --- /dev/null +++ b/Terraria/terrariaserver @@ -0,0 +1,92 @@ +#!/bin/bash +# Terraria +# Server Management Script +# Author: Daniel Gibbs +# Contributor: Bryce Van Dyk (SingingTree) +# Website: http://gameservermanagers.com +version="070915" + +#### 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="" +} + +#### Advanced Variables #### + +# Steam +appid="105600" + +# Server Details +servicename="terraria-server" +gamename="Terraria" +engine="terraria" + +# Directories +rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" +filesdir="${rootdir}/serverfiles" +systemdir="${filesdir}" +executabledir="${filesdir}" +executable="./TerrariaServer" +servercfg="serverconfig.txt" +servercfgdir="${filesdir}" +servercfgfullpath="${servercfgdir}/${servercfg}" +backupdir="${rootdir}/backups" + +# Logging +logdays="7" +gamelogdir="${filesdir}/giraffe_storage" +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 d3aefc97538917b29f20569a5904124c8b9db155 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 21:02:12 +1200 Subject: [PATCH 2/8] Add default config file --- Terraria/cfg/terraria-server.txt | 68 ++++++++++++++++++++++++++++++++ Terraria/terrariaserver | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Terraria/cfg/terraria-server.txt diff --git a/Terraria/cfg/terraria-server.txt b/Terraria/cfg/terraria-server.txt new file mode 100644 index 000000000..c04a5b556 --- /dev/null +++ b/Terraria/cfg/terraria-server.txt @@ -0,0 +1,68 @@ +#this is an example config file for TerrariaServer.exe +#use the command 'TerrariaServer.exe -config serverconfig.txt' to use this configuration or run start-server.bat +#please report crashes by emailing crashlog.txt to support@terraria.org + +#the following is a list of available command line parameters: + +#-config Specifies the configuration file to use. +#-port Specifies the port to listen on. +#-players / -maxplayers Sets the max number of players +#-pass / -password Sets the server password +#-world Load a world and automatically start the server. +#-autocreate <#> Creates a world if none is found in the path specified by -world. World size is specified by: 1(small), 2(medium), and 3(large). +#-banlist Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory. +#-worldname Sets the name of the world when using -autocreate. +#-secure Adds addition cheat protection to the server. +#-noupnp Disables automatic port forwarding +#-steam Enables Steam Support +#-lobby or Allows friends to join the server or sets it to private if Steam is enabled +#-ip Sets the IP address for the server to listen on +#-forcepriority Sets the process priority for this task. If this is used the "priority" setting below will be ignored. + +#remove the # in front of commands to enable them. + +#Load a world and automatically start the server. +#world=C:\Users\YOUR_USERNAME_HERE\My Documents\My Games\Terraria\Worlds\world1.wld + +#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large). +#autocreate=1 + +#Sets the name of the world when using autocreate +#worldname=Terraria + +#Sets the difficulty of the world when using autocreate 0(normal), 1(expert) +#difficulty=1 + +#Sets the max number of players allowed on a server. Value must be between 1 and 255 +#maxplayers=8 + +#Set the port number +#port=7777 + +#Set the server password +#password=p@55w0rd + +#Set the message of the day +#motd=Please don’t cut the purple trees! + +#Sets the folder where world files will be stored +#worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\ + +#The location of the banlist. Defaults to "banlist.txt" in the working directory. +#banlist=banlist.txt + +#Adds addition cheat protection. +#secure=1 + +#Sets the server language 1:English, 2:German, 3:Italian, 4:French, 5:Spanish +#lang=1 + +#Automatically forward ports with uPNP +#upnp=1 + +#Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off. +#npcstream=60 + +#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle +priority=1 + diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 80d9867d3..28ec3af23 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -43,7 +43,7 @@ filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" executable="./TerrariaServer" -servercfg="serverconfig.txt" +servercfg="${servicename}.txt" servercfgdir="${filesdir}" servercfgfullpath="${servercfgdir}/${servercfg}" backupdir="${rootdir}/backups" From a04db10f525f9f81159e34ec201e66b7ab5be3f4 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 21:19:05 +1200 Subject: [PATCH 3/8] Update functions to play nice with terraria --- functions/fn_details | 44 ++++++++++++++++++++++++++++++++++----- functions/fn_install_logs | 6 +++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/functions/fn_details b/functions/fn_details index 055142ee7..3463272a2 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: 280715 +# Version: 070915 # Description: Displays server infomation. @@ -19,7 +19,7 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = 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}" + echo -e "\e[34mGLIBC:\t\e[0m${glibcv}" } >> .fn_details_distro column -s $'\t' -t .fn_details_distro rm -f .fn_details_distro @@ -31,7 +31,7 @@ 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" - echo -e "\e[34mAvg Load:\t\e[0m${load}" + echo -e "\e[34mAvg Load:\t\e[0m${load}" } >> .fn_details_performance column -s $'\t' -t .fn_details_performance rm -f .fn_details_performance @@ -39,7 +39,7 @@ echo -e "" { 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" + 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 @@ -497,6 +497,38 @@ fn_details_statusbottom } +fn_details_terraria(){ +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 terraia" +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_config fn_details_distro @@ -703,6 +735,8 @@ elif [ "${engine}" == "spark" ]; then fn_details_spark elif [ "${engine}" == "starbound" ]; then fn_details_starbound +elif [ "${engine}" == "terraria" ]; then + fn_details_terraria elif [ "${engine}" == "unity3d" ]; then fn_details_unity3d elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then @@ -713,4 +747,4 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then fn_details_teamspeak3 else fn_printerrornl "Unable to detect server engine." -fi \ No newline at end of file +fi diff --git a/functions/fn_install_logs b/functions/fn_install_logs index ee1a47287..bde30a09f 100644 --- a/functions/fn_install_logs +++ b/functions/fn_install_logs @@ -2,7 +2,7 @@ # LGSM fn_install_logs function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 240415 +# Version: 070915 if [ "${checklogs}" != "1" ]; then echo "" @@ -20,7 +20,7 @@ if [ -n "${consolelogdir}" ]; then fi # If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs. -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]; then +if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ][ "${engine}" == "terraia" ]; then if [ ! -h "${rootdir}/log/server" ]; then ln -nfsv "${gamelogdir}" "${rootdir}/log/server" fi @@ -44,4 +44,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" fi fi -sleep 1 \ No newline at end of file +sleep 1 From ea85f9fac3bf2aa32d5170af6373b903cc51e0ab Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 21:37:28 +1200 Subject: [PATCH 4/8] Update game log info --- Terraria/terrariaserver | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 28ec3af23..92a00c007 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -50,7 +50,8 @@ backupdir="${rootdir}/backups" # Logging logdays="7" -gamelogdir="${filesdir}/giraffe_storage" +# Terraria Doesn't Have a Server Log +gamelogdir="" scriptlogdir="${rootdir}/log/script" consolelogdir="${rootdir}/log/console" From 539e3bc3604d59b16f4d22995dcf30532ba75c70 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 21:45:50 +1200 Subject: [PATCH 5/8] Remove game log -- terraria doesn't have any --- Terraria/terrariaserver | 3 +-- functions/fn_install_logs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 92a00c007..8afab9c3b 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -50,8 +50,7 @@ backupdir="${rootdir}/backups" # Logging logdays="7" -# Terraria Doesn't Have a Server Log -gamelogdir="" +#gamelogdir="" # Terraria Doesn't Have a Server Log scriptlogdir="${rootdir}/log/script" consolelogdir="${rootdir}/log/console" diff --git a/functions/fn_install_logs b/functions/fn_install_logs index bde30a09f..6ac465fee 100644 --- a/functions/fn_install_logs +++ b/functions/fn_install_logs @@ -20,7 +20,7 @@ if [ -n "${consolelogdir}" ]; then fi # If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs. -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ][ "${engine}" == "terraia" ]; then +if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]; then if [ ! -h "${rootdir}/log/server" ]; then ln -nfsv "${gamelogdir}" "${rootdir}/log/server" fi From faffd89e61630b03b416dc746ea41c07d61757a4 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 21:50:48 +1200 Subject: [PATCH 6/8] Revert fn_install_logs, it doesn't need changing --- functions/fn_install_logs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fn_install_logs b/functions/fn_install_logs index 6ac465fee..ee1a47287 100644 --- a/functions/fn_install_logs +++ b/functions/fn_install_logs @@ -2,7 +2,7 @@ # LGSM fn_install_logs function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 070915 +# Version: 240415 if [ "${checklogs}" != "1" ]; then echo "" @@ -44,4 +44,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" fi fi -sleep 1 +sleep 1 \ No newline at end of file From 24f3fd5252b8fb6e3835ae2914e445f5bff353e0 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 7 Sep 2015 22:02:29 +1200 Subject: [PATCH 7/8] Update travis.yaml with terraria server --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 19ec9bbb9..a2d1726d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,6 +132,15 @@ script: - bash StarBound/sbserver email-test - bash StarBound/sbserver details + - bash Terraria/terrariaserver auto-install + - bash Terraria/terrariaserver start + - bash Terraria/terrariaserver stop + - bash Terraria/terrariaserver restart + - bash Terraria/terrariaserver validate + - bash Terraria/terrariaserver monitor + - bash Terraria/terrariaserver email-test + - bash Terraria/terrariaserver details + - bash UnrealTournament2004/ut2k4server start - bash UnrealTournament2004/ut2k4server stop - bash UnrealTournament2004/ut2k4server restart @@ -152,4 +161,4 @@ script: - bash TeamSpeak3/ts3server update - bash TeamSpeak3/ts3server monitor - bash TeamSpeak3/ts3server email-test - - bash TeamSpeak3/ts3server details \ No newline at end of file + - bash TeamSpeak3/ts3server details From 0aedbf9d57e7ddf5173394ae0c477869cb422394 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Tue, 8 Sep 2015 20:58:46 +1200 Subject: [PATCH 8/8] Add config param --- Terraria/terrariaserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 8afab9c3b..57392162c 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -22,7 +22,7 @@ ip="0.0.0.0" updateonstart="off" fn_parms(){ -parms="" +parms="-config ${servercfgfullpath}" } #### Advanced Variables ####