diff --git a/StarBound/sbserver b/StarBound/sbserver new file mode 100644 index 000000000..3f1b9e9f9 --- /dev/null +++ b/StarBound/sbserver @@ -0,0 +1,93 @@ +#!/bin/bash +# Starbound +# Server Management Script +# Author: Daniel Gibbs +# Website: http://danielgibbs.co.uk +# Version: 230215 + +#### Variables #### + +# Notification Email +# (on|off) +emailnotification="off" +email="email@example.com" + +# Steam login +steamuser="username" +steampass="password" + +# Start Variables +ip="0.0.0.0" + +fn_parms(){ +parms="" +} + +#### Advanced Variables #### + +# Steam +appid="211820" + +# Server Details +servicename="sb-server" +gamename="Starbound" +engine="starbound" + +# Directories +rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" +filesdir="${rootdir}/serverfiles" +systemdir="${filesdir}" +executabledir="${filesdir}/linux64" +executable="./starbound_server" +servercfgdir="${executabledir}" +servercfg="sbboot.config" +servercfgfullpath="${executabledir}" +servercfgfullpath="${servercfgdir}/${servercfg}" +defaultcfg="sbboot.config" +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 --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45- + chmod +x "${functionfile}" + cd "${rootdir}" + sleep 1 +fi +source "${rootdir}/functions/${functionfile}" +} + +fn_functions(){ +# Functions are defined in fn_functions. +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_functions + +getopt=$1 +fn_getopt \ No newline at end of file diff --git a/functions/fn_check_logs b/functions/fn_check_logs index d601e6075..6ef91c4aa 100644 --- a/functions/fn_check_logs +++ b/functions/fn_check_logs @@ -2,7 +2,7 @@ # LGSM fn_check_logs function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 160215 +# Version: 230215 # Description: Checks that log files exist on server start # Create dir's for the script and console logs @@ -34,6 +34,14 @@ if [ ! -f "${scriptlog}" ]; then ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi + # If a server is starbound create a symbolic link to the game server logs + if [ "${engine}" == "starbound" ]; then + if [ ! -h "${rootdir}/log/server" ]; then + ln -nfsv "${gamelogdir}" "${rootdir}/log/server" + else + echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" + fi + fi # If server uses SteamCMD create a symbolic link to the Steam logs if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then @@ -42,4 +50,5 @@ if [ ! -f "${scriptlog}" ]; then echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" fi fi + sleep 1 fi \ No newline at end of file diff --git a/functions/fn_details b/functions/fn_details index 2bb5b754c..f55d2934a 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -2,7 +2,7 @@ # LGSM fn_details function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 170214 +# Version: 230214 # Description: Displays server infomation. @@ -300,6 +300,36 @@ rm -f .fn_details_ports fn_details_statusbottom } +fn_details_starbound(){ +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 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 +column -s $'\t' -t .fn_details_ports +rm -f .fn_details_ports +fn_details_statusbottom + +} + fn_details_teamspeak3(){ fn_details_config fn_details_distro @@ -441,6 +471,8 @@ elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then fn_details_source elif [ "${engine}" == "spark" ]; then fn_details_spark +elif [ "${engine}" == "starbound" ]; then + fn_details_starbound elif [ "${engine}" == "unity3d" ]; then fn_details_unity3d elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then diff --git a/functions/fn_install_logs b/functions/fn_install_logs index 1a07f11a3..bc1dc7a10 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://danielgibbs.co.uk -# Version: 260115 +# Version: 230215 echo "" echo "Creating log directorys" @@ -31,6 +31,14 @@ if [ "${gamename}" == "7 Days To Die" ]; then ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi +# If a server is starbound create a symbolic link to the game server logs +if [ "${engine}" == "starbound" ]; then + if [ ! -h "${rootdir}/log/server" ]; then + ln -nfsv "${gamelogdir}" "${rootdir}/log/server" + else + echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" + fi +fi # If server uses SteamCMD create a symbolic link to the Steam logs if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then @@ -39,4 +47,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" fi fi -sleep 1 +sleep 1 \ No newline at end of file diff --git a/functions/fn_update_dl b/functions/fn_update_dl index 5e8885d85..524b6ead9 100644 --- a/functions/fn_update_dl +++ b/functions/fn_update_dl @@ -18,4 +18,4 @@ fn_scriptlog "Updating ${servername}" sleep 1 cd "${rootdir}" cd "steamcmd" -./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}" +./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}" \ No newline at end of file