#!/bin/bash # Teeworlds # Server Management Script # Author: Daniel Gibbs # Contributor: Bryce Van Dyk (SingingTree) # Website: http://gameservermanagers.com version="141015" #### 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