2013-08-11 19:03:31 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# Teamspeak 3
|
|
|
|
# Server Management Script
|
|
|
|
# Author: Daniel Gibbs
|
2015-05-03 19:29:24 +08:00
|
|
|
# Website: http://gameservermanagers.com
|
2015-07-05 01:54:48 +08:00
|
|
|
version="040715"
|
2015-05-03 19:29:24 +08:00
|
|
|
|
2013-08-11 19:03:31 +08:00
|
|
|
#### Variables ####
|
|
|
|
|
|
|
|
# Notification Email
|
|
|
|
# (on|off)
|
|
|
|
emailnotification="off"
|
|
|
|
email="email@example.com"
|
|
|
|
|
2015-05-10 03:49:00 +08:00
|
|
|
# Start Variables
|
2015-08-16 05:50:59 +08:00
|
|
|
updateonstart="off"
|
2015-05-10 03:49:00 +08:00
|
|
|
|
2013-11-18 04:07:40 +08:00
|
|
|
# Server Details
|
2013-10-04 07:27:34 +08:00
|
|
|
gamename="Teamspeak 3"
|
2013-08-11 19:03:31 +08:00
|
|
|
servername="Teamspeak 3 Server"
|
|
|
|
servicename="ts3-server"
|
|
|
|
|
2015-02-08 22:51:13 +08:00
|
|
|
# Directories
|
|
|
|
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
selfname="$(basename $0)"
|
|
|
|
lockselfname=".${servicename}.lock"
|
2013-10-04 07:27:34 +08:00
|
|
|
filesdir="${rootdir}/serverfiles"
|
2015-02-08 22:51:13 +08:00
|
|
|
systemdir="${filesdir}"
|
|
|
|
executabledir="${filesdir}"
|
|
|
|
executable="./ts3server_startscript.sh"
|
|
|
|
servercfg="${servicename}.ini"
|
2015-07-04 05:31:09 +08:00
|
|
|
servercfgdir="${filesdir}"
|
2015-02-08 22:51:13 +08:00
|
|
|
servercfgfullpath="${servercfgdir}/${servercfg}"
|
|
|
|
backupdir="${rootdir}/backups"
|
2013-08-11 19:03:31 +08:00
|
|
|
|
|
|
|
# Logging
|
|
|
|
logdays="7"
|
2013-10-04 07:27:34 +08:00
|
|
|
gamelogdir="${filesdir}/logs"
|
|
|
|
scriptlogdir="${rootdir}/log/script"
|
|
|
|
|
|
|
|
scriptlog="${scriptlogdir}/${servicename}-script.log"
|
|
|
|
emaillog="${scriptlogdir}/${servicename}-email.log"
|
|
|
|
|
|
|
|
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
|
2013-08-11 19:03:31 +08:00
|
|
|
|
|
|
|
##### Script #####
|
|
|
|
# Do not edit
|
|
|
|
|
2015-02-08 22:51:13 +08:00
|
|
|
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
|
2015-07-05 01:54:48 +08:00
|
|
|
echo -e " loading ${functionfile}...\c"
|
2015-05-03 19:29:24 +08:00
|
|
|
wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
|
2015-02-08 22:51:13 +08:00
|
|
|
chmod +x "${functionfile}"
|
|
|
|
cd "${rootdir}"
|
2013-08-11 19:03:31 +08:00
|
|
|
fi
|
2015-02-08 22:51:13 +08:00
|
|
|
source "${rootdir}/functions/${functionfile}"
|
2013-08-11 19:03:31 +08:00
|
|
|
}
|
|
|
|
|
2015-02-08 22:51:13 +08:00
|
|
|
fn_functions(){
|
|
|
|
# Functions are defined in fn_functions.
|
|
|
|
functionfile="${FUNCNAME}"
|
|
|
|
fn_runfunction
|
2013-08-11 19:03:31 +08:00
|
|
|
}
|
|
|
|
|
2015-02-08 22:51:13 +08:00
|
|
|
fn_functions
|
2013-08-11 19:03:31 +08:00
|
|
|
|
2015-02-08 22:51:13 +08:00
|
|
|
getopt=$1
|
|
|
|
fn_getopt
|