|
@@ -1,43 +1,35 @@
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
-# Counter-Strike: Global Offensive
|
|
|
|
|
-# Server Management Script
|
|
|
|
|
|
|
+# Project: Game Server Managers - LinuxGSM
|
|
|
# Author: Daniel Gibbs
|
|
# Author: Daniel Gibbs
|
|
|
|
|
+# License: MIT License, Copyright (c) 2016 Daniel Gibbs
|
|
|
|
|
+# Purpose: Counter-Strike: Global Offensive | Server Management Script
|
|
|
|
|
+# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
|
|
|
|
|
+# Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
|
|
|
# Website: https://gameservermanagers.com
|
|
# Website: https://gameservermanagers.com
|
|
|
|
|
+
|
|
|
|
|
+# Debugging
|
|
|
if [ -f ".dev-debug" ]; then
|
|
if [ -f ".dev-debug" ]; then
|
|
|
exec 5>dev-debug.log
|
|
exec 5>dev-debug.log
|
|
|
BASH_XTRACEFD="5"
|
|
BASH_XTRACEFD="5"
|
|
|
set -x
|
|
set -x
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-version="211016"
|
|
|
|
|
|
|
+version="161125"
|
|
|
|
|
|
|
|
-#### Variables ####
|
|
|
|
|
|
|
+##########################
|
|
|
|
|
+######## Settings ########
|
|
|
|
|
+##########################
|
|
|
|
|
|
|
|
-# Notification Alerts
|
|
|
|
|
-# (on|off)
|
|
|
|
|
|
|
+#### Server Settings ####
|
|
|
|
|
|
|
|
-# Email
|
|
|
|
|
-emailalert="off"
|
|
|
|
|
-email="email@example.com"
|
|
|
|
|
-#emailfrom="email@example.com"
|
|
|
|
|
-
|
|
|
|
|
-# Pushbullet
|
|
|
|
|
-# https://www.pushbullet.com/#settings
|
|
|
|
|
-pushbulletalert="off"
|
|
|
|
|
-pushbullettoken="accesstoken"
|
|
|
|
|
-
|
|
|
|
|
-# Steam login
|
|
|
|
|
-steamuser="anonymous"
|
|
|
|
|
-steampass=""
|
|
|
|
|
-
|
|
|
|
|
-# Start Variables
|
|
|
|
|
|
|
+## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
|
|
|
# https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Dedicated_Servers#Starting_the_Server
|
|
# https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Dedicated_Servers#Starting_the_Server
|
|
|
-# [Game Modes] gametype gamemode
|
|
|
|
|
-# Arms Race 1 0
|
|
|
|
|
-# Classic Casual 0 0
|
|
|
|
|
-# Classic Competitive 0 1
|
|
|
|
|
-# Demolition 1 1
|
|
|
|
|
-# Deathmatch 1 2
|
|
|
|
|
|
|
+# [Game Modes] gametype gamemode
|
|
|
|
|
+# Arms Race 1 0
|
|
|
|
|
+# Classic Casual 0 0
|
|
|
|
|
+# Classic Competitive 0 1
|
|
|
|
|
+# Demolition 1 1
|
|
|
|
|
+# Deathmatch 1 2
|
|
|
gametype="0"
|
|
gametype="0"
|
|
|
gamemode="0"
|
|
gamemode="0"
|
|
|
defaultmap="de_dust2"
|
|
defaultmap="de_dust2"
|
|
@@ -48,48 +40,80 @@ port="27015"
|
|
|
sourcetvport="27020"
|
|
sourcetvport="27020"
|
|
|
clientport="27005"
|
|
clientport="27005"
|
|
|
ip="0.0.0.0"
|
|
ip="0.0.0.0"
|
|
|
-updateonstart="off"
|
|
|
|
|
|
|
|
|
|
-# Required: Game Server Login Token
|
|
|
|
|
|
|
+## Required: Game Server Login Token
|
|
|
# GSLT is required for running a public server.
|
|
# GSLT is required for running a public server.
|
|
|
# More info: https://gameservermanagers.com/gslt
|
|
# More info: https://gameservermanagers.com/gslt
|
|
|
gslt=""
|
|
gslt=""
|
|
|
|
|
|
|
|
-# Optional: Workshop Parameters
|
|
|
|
|
|
|
+## Optional: Workshop Parameters
|
|
|
# https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
|
|
# https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
|
|
|
# To get an authkey visit - http://steamcommunity.com/dev/apikey
|
|
# To get an authkey visit - http://steamcommunity.com/dev/apikey
|
|
|
# authkey=""
|
|
# authkey=""
|
|
|
# ws_collection_id=""
|
|
# ws_collection_id=""
|
|
|
# ws_start_map=""
|
|
# ws_start_map=""
|
|
|
|
|
|
|
|
-# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
|
|
|
|
|
|
|
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
|
|
|
|
|
+# Edit with care | https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
|
|
|
fn_parms(){
|
|
fn_parms(){
|
|
|
parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers_override ${maxplayers} +mapgroup ${mapgroup} +game_mode ${gamemode} +game_type ${gametype} +host_workshop_collection ${ws_collection_id} +workshop_start_map ${ws_start_map} -authkey ${authkey}"
|
|
parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers_override ${maxplayers} +mapgroup ${mapgroup} +game_mode ${gamemode} +game_type ${gametype} +host_workshop_collection ${ws_collection_id} +workshop_start_map ${ws_start_map} -authkey ${authkey}"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#### Advanced Variables ####
|
|
|
|
|
|
|
+#### LinuxGSM Settings ####
|
|
|
|
|
|
|
|
-# Github Branch Select
|
|
|
|
|
-# Allows for the use of different function files
|
|
|
|
|
-# from a different repo and/or branch.
|
|
|
|
|
-githubuser="GameServerManagers"
|
|
|
|
|
-githubrepo="LinuxGSM"
|
|
|
|
|
-githubbranch="master"
|
|
|
|
|
|
|
+## Notification Alerts
|
|
|
|
|
+# (on|off)
|
|
|
|
|
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
|
|
|
|
|
+emailalert="off"
|
|
|
|
|
+email="email@example.com"
|
|
|
|
|
+emailfrom=""
|
|
|
|
|
|
|
|
-# Steam
|
|
|
|
|
-appid="740"
|
|
|
|
|
|
|
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
|
|
|
|
|
+pushbulletalert="off"
|
|
|
|
|
+pushbullettoken="accesstoken"
|
|
|
|
|
+channeltag=""
|
|
|
|
|
+
|
|
|
|
|
+## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
|
|
|
|
|
+updateonstart="off"
|
|
|
|
|
+
|
|
|
|
|
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
|
|
|
|
|
+maxbackups="4"
|
|
|
|
|
+maxbackupdays="30"
|
|
|
|
|
+stoponbackup="on"
|
|
|
|
|
+
|
|
|
|
|
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
|
|
|
|
|
+consolelogging="on"
|
|
|
|
|
+logdays="7"
|
|
|
|
|
+
|
|
|
|
|
+#### LinuxGSM Advanced Settings ####
|
|
|
|
|
|
|
|
|
|
+## SteamCMD Settings
|
|
|
|
|
+# Server appid
|
|
|
|
|
+appid="740"
|
|
|
# Steam App Branch Select
|
|
# Steam App Branch Select
|
|
|
# Allows to opt into the various Steam app branches. Default branch is "".
|
|
# Allows to opt into the various Steam app branches. Default branch is "".
|
|
|
-# Example: "-beta 1.35.4.4"
|
|
|
|
|
|
|
+# Example: "-beta latest_experimental"
|
|
|
branch=""
|
|
branch=""
|
|
|
|
|
|
|
|
-# Server Details
|
|
|
|
|
-servicename="csgo-server"
|
|
|
|
|
|
|
+## Github Branch Select
|
|
|
|
|
+# Allows for the use of different function files
|
|
|
|
|
+# from a different repo and/or branch.
|
|
|
|
|
+githubuser="GameServerManagers"
|
|
|
|
|
+githubrepo="LinuxGSM"
|
|
|
|
|
+githubbranch="master"
|
|
|
|
|
+
|
|
|
|
|
+## LinuxGSM Server Details
|
|
|
|
|
+# Do not edit
|
|
|
gamename="Counter-Strike: Global Offensive"
|
|
gamename="Counter-Strike: Global Offensive"
|
|
|
engine="source"
|
|
engine="source"
|
|
|
|
|
|
|
|
-# Directories
|
|
|
|
|
|
|
+## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
|
|
|
|
|
+servicename="csgo-server"
|
|
|
|
|
+
|
|
|
|
|
+#### Directories ####
|
|
|
|
|
+# Edit with care
|
|
|
|
|
+
|
|
|
|
|
+## Work Directories
|
|
|
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
lockselfname=".${servicename}.lock"
|
|
lockselfname=".${servicename}.lock"
|
|
@@ -98,6 +122,8 @@ functionsdir="${lgsmdir}/functions"
|
|
|
libdir="${lgsmdir}/lib"
|
|
libdir="${lgsmdir}/lib"
|
|
|
tmpdir="${lgsmdir}/tmp"
|
|
tmpdir="${lgsmdir}/tmp"
|
|
|
filesdir="${rootdir}/serverfiles"
|
|
filesdir="${rootdir}/serverfiles"
|
|
|
|
|
+
|
|
|
|
|
+## Server Specific Directories
|
|
|
systemdir="${filesdir}/csgo"
|
|
systemdir="${filesdir}/csgo"
|
|
|
executabledir="${filesdir}"
|
|
executabledir="${filesdir}"
|
|
|
executable="./srcds_run"
|
|
executable="./srcds_run"
|
|
@@ -105,24 +131,26 @@ servercfg="${servicename}.cfg"
|
|
|
servercfgdefault="server.cfg"
|
|
servercfgdefault="server.cfg"
|
|
|
servercfgdir="${systemdir}/cfg"
|
|
servercfgdir="${systemdir}/cfg"
|
|
|
servercfgfullpath="${servercfgdir}/${servercfg}"
|
|
servercfgfullpath="${servercfgdir}/${servercfg}"
|
|
|
|
|
+
|
|
|
|
|
+## Backup Directory
|
|
|
backupdir="${rootdir}/backups"
|
|
backupdir="${rootdir}/backups"
|
|
|
|
|
|
|
|
-# Logging
|
|
|
|
|
-logdays="7"
|
|
|
|
|
|
|
+## Logging Directories
|
|
|
gamelogdir="${systemdir}/logs"
|
|
gamelogdir="${systemdir}/logs"
|
|
|
scriptlogdir="${rootdir}/log/script"
|
|
scriptlogdir="${rootdir}/log/script"
|
|
|
consolelogdir="${rootdir}/log/console"
|
|
consolelogdir="${rootdir}/log/console"
|
|
|
-consolelogging="on"
|
|
|
|
|
-
|
|
|
|
|
scriptlog="${scriptlogdir}/${servicename}-script.log"
|
|
scriptlog="${scriptlogdir}/${servicename}-script.log"
|
|
|
consolelog="${consolelogdir}/${servicename}-console.log"
|
|
consolelog="${consolelogdir}/${servicename}-console.log"
|
|
|
emaillog="${scriptlogdir}/${servicename}-email.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"
|
|
|
|
|
|
|
+## Logs Naming
|
|
|
|
|
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
|
|
|
|
|
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
|
|
|
|
|
|
|
|
-##### Script #####
|
|
|
|
|
-# Do not edit
|
|
|
|
|
|
|
+########################
|
|
|
|
|
+######## Script ########
|
|
|
|
|
+###### Do not edit #####
|
|
|
|
|
+########################
|
|
|
|
|
|
|
|
# Fetches core_dl for file downloads
|
|
# Fetches core_dl for file downloads
|
|
|
fn_fetch_core_dl(){
|
|
fn_fetch_core_dl(){
|
|
@@ -179,8 +207,18 @@ functionfile="${FUNCNAME}"
|
|
|
fn_fetch_core_dl
|
|
fn_fetch_core_dl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+# Prevent from running this script as root.
|
|
|
|
|
+if [ "$(whoami)" = "root" ]; then
|
|
|
|
|
+ if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
|
|
|
|
|
+ echo "[ FAIL ] Do NOT run this script as root!"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ else
|
|
|
|
|
+ core_functions.sh
|
|
|
|
|
+ check_root.sh
|
|
|
|
|
+ fi
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
core_dl.sh
|
|
core_dl.sh
|
|
|
core_functions.sh
|
|
core_functions.sh
|
|
|
-
|
|
|
|
|
getopt=$1
|
|
getopt=$1
|
|
|
-core_getopt.sh
|
|
|
|
|
|
|
+core_getopt.sh
|