From 9823aed3dfce3d87991ff70b88fafd8a3c5fb257 Mon Sep 17 00:00:00 2001 From: Marvin Lehmann Date: Sun, 20 Nov 2016 23:48:09 +0100 Subject: [PATCH] Move parameter variables to configs Setting variables in configs is preferred. --- DontStarveTogether/dstserver | 10 ++-------- lgsm/functions/info_config.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/DontStarveTogether/dstserver b/DontStarveTogether/dstserver index af9f2595a..c89ad92f6 100644 --- a/DontStarveTogether/dstserver +++ b/DontStarveTogether/dstserver @@ -29,19 +29,13 @@ shard="Master" cluster="Cluster_1" cave="false" -## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters -ip="0.0.0.0" -port="11000" -steamauthenticationport="8768" -steammasterserverport="27018" - # Edit with care persistentstorageroot="${HOME}/.klei" confdir="DoNotStarveTogether" ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters fn_parms(){ -parms="-bind_ip ${ip} -port ${port} -steam_master_server_port ${steammasterserverport} -steam_authentication_port ${steamauthenticationport} -persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}" +parms="-persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}" } #### LinuxGSM Settings #### @@ -91,7 +85,7 @@ gamename="Don't Starve Together" engine="dontstarve" ## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers -servicename="dst-server" +servicename="dst-server-${shard}" #### Directories #### # Edit with care diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 99e2038fa..3bd3ebd04 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -95,6 +95,10 @@ fn_info_config_dontstarve(){ gamemode=$(grep "game_mode" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/game_mode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') tickrate=$(grep "tick_rate" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') masterport=$(grep "master_port" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + + ip=$(grep "bind_ip" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bind_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + ipsetinconfig=1 + ipinconfigvar="bind_ip" # Not Set servername=${servername:-"NOT SET"} @@ -104,6 +108,21 @@ fn_info_config_dontstarve(){ tickrate=${tickrate:-"0"} masterport=${masterport:-"0"} fi + + if [ ! -f "${servercfgfullpath}" ]; then + port="${zero}" + steamauthenticationport="${zero}" + steammasterserverport="${zero}" + else + port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + steamauthenticationport=$(grep "authentication_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + steammasterserverport=$(grep "master_server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + + # Not Set + port=${port:-"0"} + steamauthenticationport=${steamauthenticationport:-"0"} + steammasterserverport=${steammasterserverport:-"0"} + fi } fn_info_config_minecraft(){