diff --git a/7DaysToDie/sdtdserver b/7DaysToDie/sdtdserver index 44848ee9c..b3112820c 100644 --- a/7DaysToDie/sdtdserver +++ b/7DaysToDie/sdtdserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -122,14 +122,14 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/ARKSurvivalEvolved/arkserver b/ARKSurvivalEvolved/arkserver index 3cd841131..2304ef566 100644 --- a/ARKSurvivalEvolved/arkserver +++ b/ARKSurvivalEvolved/arkserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -120,13 +120,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Arma3/arma3server b/Arma3/arma3server index 2a02b8da0..ff296e3bc 100644 --- a/Arma3/arma3server +++ b/Arma3/arma3server @@ -10,7 +10,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -25,11 +25,11 @@ steampass="password" # Start Variables ip="0.0.0.0" -srvport="2302" +port="2302" updateonstart="off" fn_parms(){ -parms="-netlog -ip=${ip} -port=${srvport} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -autoinit -loadmissiontomemory" +parms="-netlog -ip=${ip} -port=${port} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -autoinit -loadmissiontomemory" } # ARMA 3 Modules @@ -143,13 +143,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/BlackMesa/bmdmserver b/BlackMesa/bmdmserver index 74825317a..7601f826a 100644 --- a/BlackMesa/bmdmserver +++ b/BlackMesa/bmdmserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/BladeSymphony/bsserver b/BladeSymphony/bsserver index a0a65b8e6..87f1ff2ee 100644 --- a/BladeSymphony/bsserver +++ b/BladeSymphony/bsserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/CounterStrike/csserver b/CounterStrike/csserver index 83dcc0b47..4fa7104d8 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/CounterStrikeConditionZero/csczserver b/CounterStrikeConditionZero/csczserver index 0c700f370..a6eca599c 100644 --- a/CounterStrikeConditionZero/csczserver +++ b/CounterStrikeConditionZero/csczserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver index 1a06e28bf..9681d7e56 100755 --- a/CounterStrikeGlobalOffensive/csgoserver +++ b/CounterStrikeGlobalOffensive/csgoserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -149,13 +149,10 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions - -getopt=$1 -fn_getopt +core_functions.sh \ No newline at end of file diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index 9bd6001e3..3efde2766 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/DayOfDefeat/dodserver b/DayOfDefeat/dodserver index b73a99c6e..88ea3b92a 100644 --- a/DayOfDefeat/dodserver +++ b/DayOfDefeat/dodserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index 03788b07c..5d80d01b0 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/DeathmatchClassic/dmcserver b/DeathmatchClassic/dmcserver index 863296f07..0b9efa02a 100644 --- a/DeathmatchClassic/dmcserver +++ b/DeathmatchClassic/dmcserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/DontStarveTogether/dstserver b/DontStarveTogether/dstserver index 029735e52..8ecf55c88 100644 --- a/DontStarveTogether/dstserver +++ b/DontStarveTogether/dstserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -120,13 +120,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/DoubleActionBoogaloo/dabserver b/DoubleActionBoogaloo/dabserver index b6bc46ac2..00b8c70f6 100644 --- a/DoubleActionBoogaloo/dabserver +++ b/DoubleActionBoogaloo/dabserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/FistfulOfFrags/fofserver b/FistfulOfFrags/fofserver index 42b16cd55..eaa85694f 100644 --- a/FistfulOfFrags/fofserver +++ b/FistfulOfFrags/fofserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver index 455671cab..363eb01c8 100644 --- a/GarrysMod/gmodserver +++ b/GarrysMod/gmodserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -137,13 +137,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index 530cdfbff..271a024ef 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/HalfLifeDeathmatch/hldmserver b/HalfLifeDeathmatch/hldmserver index bf3e13dba..b74914da1 100644 --- a/HalfLifeDeathmatch/hldmserver +++ b/HalfLifeDeathmatch/hldmserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -125,13 +125,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/HalfLifeDeathmatchSource/hldmsserver b/HalfLifeDeathmatchSource/hldmsserver index 0b6473e71..33b2d0723 100644 --- a/HalfLifeDeathmatchSource/hldmsserver +++ b/HalfLifeDeathmatchSource/hldmsserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Hurtworld/hwserver b/Hurtworld/hwserver index e74f5648a..8c117c1bb 100644 --- a/Hurtworld/hwserver +++ b/Hurtworld/hwserver @@ -139,14 +139,14 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Insurgency/insserver b/Insurgency/insserver index 85f9fafa9..ff37e41f8 100644 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/JustCause2/jc2server b/JustCause2/jc2server index a60af82cd..5435a3121 100644 --- a/JustCause2/jc2server +++ b/JustCause2/jc2server @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -119,13 +119,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver index e24d6e2be..2aa5af27b 100644 --- a/KillingFloor/kfserver +++ b/KillingFloor/kfserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -128,13 +128,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Left4Dead/l4dserver b/Left4Dead/l4dserver index c11d7f5f7..519ab1379 100644 --- a/Left4Dead/l4dserver +++ b/Left4Dead/l4dserver @@ -10,7 +10,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index 238e958a5..6c966cb6e 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -125,13 +125,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Mumble/mumbleserver b/Mumble/mumbleserver index 10c284dab..c0bfa4692 100644 --- a/Mumble/mumbleserver +++ b/Mumble/mumbleserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -105,14 +105,14 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/NS2Combat/ns2cserver b/NS2Combat/ns2cserver index df2e5644f..a5683bf81 100644 --- a/NS2Combat/ns2cserver +++ b/NS2Combat/ns2cserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -131,13 +131,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index 3e8654da0..d53651b7f 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -131,13 +131,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver index 8081dcee4..26c836f2d 100644 --- a/NoMoreRoomInHell/nmrihserver +++ b/NoMoreRoomInHell/nmrihserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/OpposingForce/opforserver b/OpposingForce/opforserver index 7cffd927f..61e9b4128 100644 --- a/OpposingForce/opforserver +++ b/OpposingForce/opforserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/PiratesVikingandKnightsII/pvkiiserver b/PiratesVikingandKnightsII/pvkiiserver index d589170f7..5a4588753 100644 --- a/PiratesVikingandKnightsII/pvkiiserver +++ b/PiratesVikingandKnightsII/pvkiiserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/ProjectZomboid/pzserver b/ProjectZomboid/pzserver index c1c1c884d..701827e96 100644 --- a/ProjectZomboid/pzserver +++ b/ProjectZomboid/pzserver @@ -10,7 +10,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -120,13 +120,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/README.md b/README.md index b69d5dc8a..6b7056b55 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ linux Game Server Managers [![Build Status](https://travis-ci.org/dgibbs64/linuxgsm.svg?branch=master)](https://travis-ci.org/dgibbs64/linuxgsm) +[![Under Development](https://badge.waffle.io/dgibbs64/linuxgsm.svg?label=Under%20Development&title=Under%20Development)](http://waffle.io/dgibbs64/linuxgsm) The Linux Game Server Managers are command line tools for quick, simple deployment and management of various dedicated game servers and voice comms servers. @@ -49,4 +50,4 @@ If you want to donate to the project you can via PayPal, Flattr or Gratipay. I h
  • Twitter
  • Facebook
  • Google+
  • - \ No newline at end of file + diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index 83696e4ed..4e6424814 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -124,13 +124,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Ricochet/ricochetserver b/Ricochet/ricochetserver index 1da3738b9..555c1b39b 100644 --- a/Ricochet/ricochetserver +++ b/Ricochet/ricochetserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/SeriousSam3BFE/ss3sserver b/SeriousSam3BFE/ss3sserver index 27fed4bd2..0ffefc5e8 100644 --- a/SeriousSam3BFE/ss3sserver +++ b/SeriousSam3BFE/ss3sserver @@ -123,13 +123,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/StarBound/sbserver b/StarBound/sbserver index 770570fa2..c8253a643 100644 --- a/StarBound/sbserver +++ b/StarBound/sbserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -119,13 +119,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index a1c407e6b..984817ab0 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -131,13 +131,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/TeamFortressClassic/tfcserver b/TeamFortressClassic/tfcserver index dc172a425..d1ee8b4c3 100644 --- a/TeamFortressClassic/tfcserver +++ b/TeamFortressClassic/tfcserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -126,13 +126,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/TeamSpeak3/ts3server b/TeamSpeak3/ts3server index 5262b41f8..311474c30 100644 --- a/TeamSpeak3/ts3server +++ b/TeamSpeak3/ts3server @@ -103,13 +103,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Teeworlds/twserver b/Teeworlds/twserver index 8414ae06c..a051ebe9e 100644 --- a/Teeworlds/twserver +++ b/Teeworlds/twserver @@ -10,7 +10,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -122,13 +122,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index e2da26348..f8088bd16 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -10,7 +10,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -121,13 +121,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index d8b7a1512..d74310b30 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="201215" +version="271215" #### Variables #### @@ -114,13 +114,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index c89ce2406..a1dd53887 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -113,13 +113,13 @@ fn_runfunction(){ fn_getgithubfile "functions/${functionfile}" 1 } -fn_functions(){ -# Functions are defined in fn_functions. +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh getopt=$1 -fn_getopt +core_getopt.sh diff --git a/functions/README.md b/functions/README.md index bb76d811c..f18a8a161 100644 --- a/functions/README.md +++ b/functions/README.md @@ -2,3 +2,15 @@ These functions are universal functions that work in all scripts. +

    Function Names

    +Functions have been named to give an idea of what the function does. + +* core: Essential functions that are will always run first. +* command: Primary command function. +* check: Runs checks that will either halt on or fix an issue. +* dev: development functions. +* fix: Applies a game server specific fix. +* info: retrieves information from a source such as config file or the OS. +* install: Functions related to the installer. +* monitor: Functions related to monitor. +* update: Functions that update the game server. diff --git a/functions/check.sh b/functions/check.sh index 140627aeb..61c8083ce 100644 --- a/functions/check.sh +++ b/functions/check.sh @@ -2,7 +2,7 @@ # LGSM fn_check function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Overall function for managing checks. # Runs checks that will either halt on or fix an issue. @@ -23,7 +23,7 @@ fi no_check_logs=( debug details install map-compressor ) fn_module_compare "${cmd}" "${no_check_logs[@]}" if [ $? != 0 ]; then - fn_check_logs + check_logs.sh fi check_ip=( debug ) @@ -43,6 +43,4 @@ check_ip=( start ) fn_module_compare "${cmd}" "${no_check_logs[@]}" if [ $? != 0 ]; then check_tmux.sh -fi - -#fn_check_ts3status # may need to move out of checks \ No newline at end of file +fi \ No newline at end of file diff --git a/functions/fn_check_ip b/functions/check_ip.sh similarity index 95% rename from functions/fn_check_ip rename to functions/check_ip.sh index 67c76fec8..1a877c12a 100644 --- a/functions/fn_check_ip +++ b/functions/check_ip.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_ip function +# LGSM check_ip.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Automatically identifies the server interface IP. # If multiple interfaces are detected the user will need to manualy set using ip="0.0.0.0". diff --git a/functions/fn_check_logs b/functions/check_logs.sh similarity index 83% rename from functions/fn_check_logs rename to functions/check_logs.sh index 526a4036b..92ed2cad1 100644 --- a/functions/fn_check_logs +++ b/functions/check_logs.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_logs function +# LGSM check_logs.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Checks that log files exist on server start @@ -13,5 +13,5 @@ if [ ! -d "${scriptlogdir}" ]; then fn_printinfo "Checking for log files: Creating log files" echo -en "\n" checklogs=1 - fn_install_logs + install_logs.sh fi diff --git a/functions/fn_check_root b/functions/check_root.sh similarity index 76% rename from functions/fn_check_root rename to functions/check_root.sh index 16f253e35..3f62a5d30 100644 --- a/functions/fn_check_root +++ b/functions/check_root.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_root function +# LGSM check_root.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" if [ $(whoami) = "root" ]; then fn_printfailnl "Do NOT run this script as root!" diff --git a/functions/fn_check_steamcmd b/functions/check_steamcmd.sh similarity index 96% rename from functions/fn_check_steamcmd rename to functions/check_steamcmd.sh index d29e218b1..049867eda 100644 --- a/functions/fn_check_steamcmd +++ b/functions/check_steamcmd.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_steamcmd function +# LGSM check_steamcmd.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD diff --git a/functions/fn_check_steamuser b/functions/check_steamuser.sh similarity index 91% rename from functions/fn_check_steamuser rename to functions/check_steamuser.sh index 35e7c4f95..a807dc70e 100644 --- a/functions/fn_check_steamuser +++ b/functions/check_steamuser.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_steamuser function +# LGSM check_steamuser.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" if [ "${steamuser}" == "username" ]; then fn_printfailnl "Steam login not set. Update steamuser." diff --git a/functions/fn_check_systemdir b/functions/check_systemdir.sh similarity index 62% rename from functions/fn_check_systemdir rename to functions/check_systemdir.sh index fba1566f0..30a192609 100644 --- a/functions/fn_check_systemdir +++ b/functions/check_systemdir.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LGSM fn_check_systemdir function +# LGSM check_systemdir.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" -if [ ! -e "${systemdir}" ]; then +if [ ! -d "${systemdir}" ]; then fn_printfailnl "Cannot access ${systemdir}: No such directory" exit 1 fi diff --git a/functions/fn_check_tmux b/functions/check_tmux.sh similarity index 91% rename from functions/fn_check_tmux rename to functions/check_tmux.sh index 13aedad4f..ac142ebe4 100644 --- a/functions/fn_check_tmux +++ b/functions/check_tmux.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_tmux function +# LGSM check_tmux.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Checks if tmux is installed as too many users do not RTFM or know how to use Google. diff --git a/functions/fn_backup b/functions/command_backup.sh similarity index 92% rename from functions/fn_backup rename to functions/command_backup.sh index 33b946d1a..6a2f9d301 100644 --- a/functions/fn_backup +++ b/functions/command_backup.sh @@ -1,14 +1,14 @@ #!/bin/bash -# LGSM fn_backup function +# LGSM command_backup.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Creates a .tar.gz file in the backup directory. local modulename="Backup" -fn_check_root -fn_check_systemdir +check_root.sh +check_systemdir.sh backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')" echo "" echo "${gamename} Backup" @@ -34,7 +34,7 @@ if [ "${tmuxwc}" -eq 1 ]; then while true; do read -p "Stop ${servicename} while running the backup? [y/N]" yn case $yn in - [Yy]* ) fn_stop; break;; + [Yy]* ) command_stop.sh; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac diff --git a/functions/fn_console b/functions/command_console.sh similarity index 87% rename from functions/fn_console rename to functions/command_console.sh index 992c9bd1a..9f3476d1c 100644 --- a/functions/fn_console +++ b/functions/command_console.sh @@ -1,14 +1,14 @@ #!/bin/bash -# LGSM fn_console function +# LGSM command_console.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Gives access to the server tmux console. local modulename="Console" -fn_check_root -fn_check_systemdir +check_root.sh +check_systemdir.sh echo "" echo "${gamename} Console" echo "============================" @@ -26,7 +26,7 @@ esac done fn_printdots "Starting" sleep 1 -fn_check_tmux +check_tmux.sh tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then fn_printoknl "Starting" @@ -40,7 +40,7 @@ else while true; do read -p "Do you want to start the server? [y/N]" yn case $yn in - [Yy]* ) fn_start; break;; + [Yy]* ) command_start.sh; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac diff --git a/functions/fn_debug b/functions/command_debug.sh similarity index 88% rename from functions/fn_debug rename to functions/command_debug.sh index cb4067943..e58fe0ab4 100644 --- a/functions/fn_debug +++ b/functions/command_debug.sh @@ -1,17 +1,17 @@ #!/bin/bash -# LGSM fn_debug function +# LGSM command_debug.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Runs the server without tmux. Runs direct from the terminal. local modulename="Debug" -fn_check_root -fn_check_systemdir -fn_check_ip -fn_check_logs -fn_details_distro +check_root.sh +check_systemdir.sh +check_ip.sh +check_logs.sh +info_distro.sh fn_parms echo "" echo "${gamename} Debug" @@ -45,7 +45,7 @@ fn_scriptlog "Starting debug" fn_printinfonl "Stopping any running servers" fn_scriptlog "Stopping any running servers" sleep 1 -fn_stop +command_stop.sh fn_printdots "Starting debug" sleep 1 fn_printok "Starting debug" @@ -56,11 +56,11 @@ cd "${executabledir}" if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then startfix=1 - fn_csgofix + fix_csgo.sh elif [ "${gamename}" == "Insurgency" ]; then - fn_insfix + fix_ins.sh elif [ "${gamename}" == "ARMA 3" ]; then - fn_arma3fix + fix_arma3.sh fi ${executable} ${parms} -debug else diff --git a/functions/fn_details b/functions/command_details.sh similarity index 96% rename from functions/fn_details rename to functions/command_details.sh index 30313d4e4..927f0beb7 100644 --- a/functions/fn_details +++ b/functions/command_details.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_details function +# LGSM command_details.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="211215" +lgsm_version="271215" # Description: Displays server infomation. @@ -105,7 +105,7 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = # online status if [ "${gamename}" == "Teamspeak 3" ]; then - fn_check_ts3status + info_ts3status.sh if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m" else @@ -226,9 +226,9 @@ echo -e "" # Engine Specific details fn_details_avalanche(){ -fn_check_ip -fn_details_config -fn_details_distro +check_ip.sh +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -252,9 +252,9 @@ fn_details_statusbottom } fn_details_dontstarve(){ -fn_check_ip -fn_details_config -fn_details_distro +check_ip.sh +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -278,9 +278,9 @@ fn_details_statusbottom } fn_details_projectzomboid(){ -fn_check_ip -fn_details_config -fn_details_distro +check_ip.sh +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -305,10 +305,10 @@ fn_details_statusbottom fn_details_realvirtuality(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -339,10 +339,10 @@ fn_details_statusbottom } fn_details_seriousengine35(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -368,10 +368,10 @@ fn_details_statusbottom } fn_details_source(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -400,10 +400,10 @@ fn_details_statusbottom } fn_details_spark(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -438,10 +438,10 @@ fn_details_statusbottom } fn_details_starbound(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -469,8 +469,8 @@ fn_details_statusbottom } fn_details_teamspeak3(){ -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -497,10 +497,10 @@ fn_details_statusbottom } fn_details_teeworlds(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -525,10 +525,10 @@ fn_details_statusbottom } fn_details_terraria(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -555,10 +555,10 @@ fn_details_statusbottom } fn_details_sdtd(){ -fn_check_ip +fn_check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -602,7 +602,7 @@ fn_details_statusbottom } fn_details_hurtworld(){ -fn_check_ip +check_ip.sh fn_parms fn_details_config fn_details_distro @@ -633,10 +633,10 @@ fn_details_statusbottom } fn_details_unreal(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -690,10 +690,10 @@ fn_details_statusbottom } fn_details_ark(){ -fn_check_ip +check_ip.sh fn_parms -fn_details_config -fn_details_distro +info_config.sh +info_distro.sh fn_details_os fn_details_performance fn_details_disk @@ -734,7 +734,7 @@ if [ ! -e "${servercfgfullpath}" ]; then fi fi -fn_details_glibc +info_glibc.sh if [ "${engine}" == "avalanche" ]; then fn_details_avalanche diff --git a/functions/fn_install b/functions/command_install.sh similarity index 59% rename from functions/fn_install rename to functions/command_install.sh index 16de61dfa..8f8d0a8ec 100644 --- a/functions/fn_install +++ b/functions/command_install.sh @@ -2,47 +2,47 @@ # LGSM fn_install function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="251215" +lgsm_version="271215" -fn_check_root -fn_install_header -fn_install_serverdir +check_root.sh +install_header.sh +install_serverdir.sh # Download and install if [ "${gamename}" == "Unreal Tournament 2004" ]; then - fn_install_ut2k4filesdl - fn_install_ut2k4 - fn_install_ut2k4key + install_dl_ut2k4.sh + install_ut2k4.sh + install_ut2k4_key.sh elif [ "${gamename}" == "Unreal Tournament 99" ]; then - fn_install_ut99filesdl - fn_install_ut99 + install_dl_ut99.sh + install_ut99.sh elif [ "${gamename}" == "Teamspeak 3" ]; then - fn_install_ts3 + install_ts3.sh elif [ ! -z "${appid}" ]; then - fn_install_steamcmd - fn_install_serverfiles - fn_install_steamfix + install_steamcmd.sh + install_serverfiles.sh + install_fix_steam.sh fi # Configuration -fn_install_glibcfix -fn_install_logs -fn_install_gsquery -fn_install_config +fix_glibc.sh +install_logs.sh +install_gsquery.sh +install_config.sh if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then - fn_install_gslt - fn_csgofix + install_gslt.sh + fix_csgo.sh elif [ "${gamename}" == "Teamspeak 3" ]; then - fn_install_ts3db + install_ts3db.sh elif [ "${gamename}" == "Team Fortress 2" ]; then - fn_install_gslt + install_gslt.sh elif [ "${gamename}" == "Killing Floor" ]; then - fn_install_kffix + install_fix_kf.sh elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then - fn_install_rofix + install_fix_ro.sh elif [ "${gamename}" == "Unreal Tournament 2004" ]; then - fn_install_ut2k4fix + install_fix_ut2k4.sh elif [ "${gamename}" == "Unreal Tournament 99" ]; then - fn_install_ut99fix + install_fix_ut99.sh fi -fn_install_complete +install_complete.sh diff --git a/functions/fn_monitor b/functions/command_monitor.sh similarity index 91% rename from functions/fn_monitor rename to functions/command_monitor.sh index 64a719dec..f99409f8d 100644 --- a/functions/fn_monitor +++ b/functions/command_monitor.sh @@ -1,18 +1,18 @@ #!/bin/bash -# LGSM fn_monitor function +# LGSM command_monitor.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Monitors server by checking for running proccesses -# then passes to fn_monitor_query. +# then passes to monitor_gsquery.sh. local modulename="Monitor" fn_monitor_teamspeak3(){ -fn_check_root -fn_check_systemdir -fn_logs +check_root.sh +check_systemdir.sh +logs.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 @@ -27,7 +27,7 @@ fi fn_printdots "Checking session: CHECKING" fn_scriptlog "Checking session: CHECKING" sleep 1 -fn_check_ts3status +info_ts3status.sh if [ "${ts3status}" = "Server is running" ]; then fn_printok "Checking session: OK" fn_scriptlog "Checking session: OK" @@ -45,7 +45,7 @@ else if [ "${emailnotification}" = "on" ]; then subject="${servicename} Monitor - Restarting ${servername}" actiontaken="restarted ${servername}" - fn_email + email.sh fi fi sleep 0.5 @@ -54,10 +54,10 @@ fn_restart } fn_monitor_tmux(){ -fn_check_root -fn_check_systemdir -fn_check_ip -fn_details_config +check_root.sh +check_systemdir.sh +check_ip.sh +info_config.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 @@ -83,7 +83,7 @@ if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "$ echo -en "\n" if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then - fn_monitor_query + monitor_gsquery.sh fi exit $? else @@ -95,10 +95,10 @@ if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "$ subject="${servicename} Monitor - Starting ${servername}" failurereason="${servicename} process not running" actiontaken="${servicename} has been restarted" - fn_email + email.sh fi fn_scriptlog "Monitor is starting ${servername}" - fn_start + command_start.sh fi else fn_printinfonl "SteamCMD is currently checking for updates" diff --git a/functions/fn_start b/functions/command_start.sh similarity index 94% rename from functions/fn_start rename to functions/command_start.sh index 742c76b60..9c72ae108 100644 --- a/functions/fn_start +++ b/functions/command_start.sh @@ -1,23 +1,23 @@ #!/bin/bash -# LGSM fn_start function +# LGSM command_start.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Starts the server. local modulename="Starting" fn_start_teamspeak3(){ -fn_check_root -fn_check_systemdir -fn_check_logs -fn_check_ts3status +check_root.sh +check_systemdir.sh +check_logs.sh +info_ts3status.sh if [ "${ts3status}" != "Server is running" ]; then # Will check for updates is updateonstart is yes if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then - fn_update_check + update_check.sh fi fi @@ -38,7 +38,7 @@ if [ ! -e "${servercfgfullpath}" ]; then touch "${servercfgfullpath}" fi -fn_logs +logs.sh fn_printdots "${servername}" fn_scriptlog "${servername}" @@ -58,7 +58,7 @@ date > "${rootdir}/${lockselfname}" cd "${executabledir}" ./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1 sleep 1 -fn_check_ts3status +info_ts3status.sh if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then fn_printfailnl "Unable to start ${servername}" fn_scriptlog "Unable to start ${servername}" @@ -73,38 +73,38 @@ echo -en "\n" } fn_start_tmux(){ -fn_check_root -fn_check_systemdir -fn_check_ip -fn_check_logs +check_root.sh +check_systemdir.sh +check_ip.sh +check_logs.sh if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then startfix=1 - fn_csgofix + fix_csgo.sh elif [ "${gamename}" == "Insurgency" ]; then - fn_insfix + fix_ins.sh elif [ "${gamename}" == "ARMA 3" ]; then - fn_arma3fix + fix_arma3.sh fi -fn_details_config +info_config.sh fn_parms -fn_logs +logs.sh tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") # Will check for updates if updateonstart is yes if [ "${tmuxwc}" -eq 0 ]; then if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then - fn_update_check + update_check.sh fi fi fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -fn_check_tmux +check_tmux.sh if [ "${gamename}" != "Mumble" ]; then - fn_check_steamcmd + check_steamcmd.sh fi if [ "${tmuxwc}" -eq 0 ]; then diff --git a/functions/fn_stop b/functions/command_stop.sh similarity index 96% rename from functions/fn_stop rename to functions/command_stop.sh index 35244f1fd..d567489e0 100644 --- a/functions/fn_stop +++ b/functions/command_stop.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_stop function +# LGSM command_stop.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Stops the server. @@ -29,12 +29,12 @@ sdtd_telnet(){ } fn_stop_teamspeak3(){ -fn_check_root -fn_check_systemdir +check_root.sh +check_systemdir.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -fn_check_ts3status +info_ts3status.sh if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then fn_printfail "${servername} is already stopped" fn_scriptlog "${servername} is already stopped" @@ -50,13 +50,13 @@ echo -en "\n" } fn_stop_tmux(){ -fn_check_root -fn_check_systemdir -fn_details_config +check_root.sh +check_systemdir.sh +info_config.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -fn_check_tmux +check_tmux.sh if [ "${gamename}" == "7 Days To Die" ] ; then # if game is 7 Days To Die, we need special, graceful shutdown via telnet connection. @@ -70,7 +70,7 @@ if [ "${gamename}" == "7 Days To Die" ] ; then # If failed using localhost will use servers ip refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF") if [ -n "${refused}" ]; then - fn_check_ip + check_ip.sh telnetip=${ip} fn_printwarn "Attempting graceful shutdown via telnet: localhost failed" fn_scriptlog "Warning! Attempting graceful shutdown failed using localhost" diff --git a/functions/command_update.sh b/functions/command_update.sh new file mode 100644 index 000000000..e69de29bb diff --git a/functions/fn_validate b/functions/command_validate.sh similarity index 87% rename from functions/fn_validate rename to functions/command_validate.sh index b4299bc8c..7d62f0dd5 100644 --- a/functions/fn_validate +++ b/functions/command_validate.sh @@ -1,16 +1,16 @@ #!/bin/bash -# LGSM fn_validate function +# LGSM command_validate.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Runs a server validation. local modulename="Validate" fn_validation(){ -fn_check_steamcmd -fn_check_steamuser +check_steamcmd.sh +check_steamuser.sh fn_printwarn "Validating may overwrite some customised files." sleep 1 echo -en "\n" @@ -37,18 +37,18 @@ fi if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then echo -e '\n' - fn_csgofix + fix_csgo.sh fi fn_scriptlog "Checking complete" } -fn_check_root -fn_check_systemdir +check_root.sh +check_systemdir.sh tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_stop + command_stop.sh fn_validation - fn_start + command_start.sh else fn_validation fi diff --git a/functions/fn_compress_unreal2maps b/functions/compress_unreal2_maps.sh similarity index 90% rename from functions/fn_compress_unreal2maps rename to functions/compress_unreal2_maps.sh index fec5d113f..5992cb8f6 100644 --- a/functions/fn_compress_unreal2maps +++ b/functions/compress_unreal2_maps.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LGSM fn_compress_unreal2maps function +# LGSM compress_unreal2_maps.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" -fn_check_root +check_root.sh clear echo "${gamename} Map Compressor" echo "============================" diff --git a/functions/fn_compress_ut99maps b/functions/compress_ut99_maps.sh similarity index 90% rename from functions/fn_compress_ut99maps rename to functions/compress_ut99_maps.sh index f9e0c9433..ba14cb663 100644 --- a/functions/fn_compress_ut99maps +++ b/functions/compress_ut99_maps.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LGSM fn_compress_ut99maps function +# LGSM compress_ut99_maps.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" -fn_check_root +check_root.sh clear echo "${gamename} Map Compressor" echo "============================" diff --git a/functions/core_functions.sh b/functions/core_functions.sh new file mode 100644 index 000000000..868f65885 --- /dev/null +++ b/functions/core_functions.sh @@ -0,0 +1,373 @@ +#!/bin/bash +# LGSM core_functions.sh function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +lgsm_version="271215" + +# Description: Defines all functions to allow download and execution of functions using fn_runfunction. +# This function is called first before any other function. Without this file other functions would not load. + +#Legacy functions + +fn_functions(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_getopt(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Core + +core_getopt.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +core_messages.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Command + +command_console.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_debug.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_details.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_backup.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_monitor.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_start.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_stop.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_validate.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +command_install.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_restart(){ +local modulename="Restarting" +info_config.sh +fn_scriptlog "${servername}" +command_stop.sh +command_start.sh +} + + +# Checks + +check.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_ip.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_logs.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_root.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_steamcmd.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_steamuser.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_systemdir.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +check_tmux.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Compress + +compress_unreal2_maps.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +compress_ut99_maps.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Dev + +dev_debug.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +dev_detect_deps.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Fix + +fix_arma3.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fix_csgo.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fix_ins.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Info + +info_config.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +info_distro.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +info_glibc.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +info_ts3status.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Email + +email.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +email_test.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Logs + +logs.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Monitor + +monitor_gsquery.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# Update + +update_check.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +update_functions.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +update_dl.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +update_functions.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + + +# +## Installer functions +# + +fn_autoinstall(){ +autoinstall=1 +command_install.sh +} + +install_complete.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_config.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fix_glibc.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_gsquery.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_gslt.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_header.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_fix_kf.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_logs.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_retry.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_fix_ro.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_serverdir.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} +install_serverfiles.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_steamcmd.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_fix_steam.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_ts3.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_ut2k4.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_dl_ut2k4.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_fix_ut2k4.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_ut2k4_key.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_ut99.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_dl_ut99.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +install_fix_ut99.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +# Calls on-screen messages +core_messages.sh diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh new file mode 100644 index 000000000..93b0a005c --- /dev/null +++ b/functions/core_getopt.sh @@ -0,0 +1,427 @@ +#!/bin/bash +# LGSM core_getopt.sh function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +lgsm_version="271215" + +# Description: getopt arguments. + +fn_getopt_generic(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + u|update) + update_check.sh;; + fu|force-update|update-restart) + forceupdate=1; + update_check.sh;; + uf|update-functions) + update_functions.sh;; + v|validate) + command_validate.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + c|console) + command_console.sh;; + d|debug) + command_debug.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + ai|auto-install) + fn_autoinstall;; + dd|depsdetect) + dev_detect_deps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." + echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + } | column -s $'\t' -t + esac +exit +} + +fn_getopt_teamspeak3(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + u|update) + update_check.sh;; + uf|update-functions) + update_functions.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + ai|auto-install) + fn_autoinstall;; + dd|depsdetect) + dev_detect_deps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate\t\e[0mChecks and applies updates from teamspeak.com." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + } | column -s $'\t' -t + esac +exit +} + +fn_getopt_mumble(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + uf|update-functions) + update_functions.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + b|backup) + command_backup.sh;; + dev|dev-debug) + dev_debug.sh;; + console) + command_console.sh;; + d|debug) + command_debug.sh;; + dd|depsdetect) + dev_detect_deps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + } | column -s $'\t' -t + esac +exit +} + +fn_getopt_gmodserver(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + u|update) + update_check.sh;; + fu|force-update|update-restart) + forceupdate=1; + update_check.sh;; + uf|update-functions) + update_functions.sh;; + v|validate) + command_validate.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + c|console) + command_console.sh;; + d|debug) + command_debug.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + ai|auto-install) + fn_autoinstall;; + dd|depsdetect) + dev_detect_deps.sh;; + gc|gmod-content) + fn_content_gmod;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." + echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + echo -e "\e[34mgmod-content\t\e[0mDownload gmod add-on content." + } | column -s $'\t' -t + esac +exit +} + +fn_getopt_unreal(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + uf|update-functions) + update_functions.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + c|console) + command_console.sh;; + d|debug) + command_debug.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + mc|map-compressor) + compress_ut99_maps.sh;; + dd|depsdetect) + dev_detect_deps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." + } | column -s $'\t' -t + esac +exit +} + + +fn_getopt_unreal2(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + u|update) + update_check.sh;; + fu|force-update|update-restart) + forceupdate=1; + update_check.sh;; + uf|update-functions) + update_functions.sh;; + v|validate) + command_validate.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + c|console) + command_console.sh;; + d|debug) + command_debug.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + ai|auto-install) + fn_autoinstall;; + dd|depsdetect) + dev_detect_deps.sh;; + mc|map-compressor) + compress_unreal2_maps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." + echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." + } | column -s $'\t' -t + esac +exit +} + + +fn_getopt_ut2k4(){ +case "$getopt" in + st|start) + command_start.sh;; + sp|stop) + command_stop.sh;; + r|restart) + fn_restart;; + uf|update-functions) + update_functions.sh;; + m|monitor) + command_monitor.sh;; + et|email-test) + email_test.sh;; + d|details) + command_details.sh;; + b|backup) + command_backup.sh;; + c|console) + command_console.sh;; + d|debug) + command_debug.sh;; + dev|dev-debug) + dev_debug.sh;; + i|install) + command_install.sh;; + mc|map-compressor) + compress_ut99_maps.sh;; + dd|depsdetect) + dev_detect_deps.sh;; + *) + echo "Usage: $0 [option]" + echo "${gamename} - Linux Game Server Manager - Version ${version}" + echo "http://gameservermanagers.com/${selfname}" + echo -e "" + echo -e "\e[93mCommands\e[0m" + { + echo -e "\e[34mstart\t\e[0mStart the server." + echo -e "\e[34mstop\t\e[0mStop the server." + echo -e "\e[34mrestart\t\e[0mRestart the server." + echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." + echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." + echo -e "\e[34memail-test\t\e[0mSends test monitor email." + echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." + echo -e "\e[34mbackup\t\e[0mCreate archive of the server." + echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." + echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." + echo -e "\e[34minstall\t\e[0mInstall the server." + echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." + } | column -s $'\t' -t + esac +exit +} + +if [ "${gamename}" == "Mumble" ]; then + fn_getopt__mumble +elif [ "${gamename}" == "Teamspeak 3" ]; then + fn_getopt_teamspeak3 +elif [ "${engine}" == "unreal2" ]; then + if [ "${gamename}" == "Unreal Tournament 2004" ]; then + fn_getopt_ut2k4 + else + fn_getopt_unreal2 + fi +elif [ "${engine}" == "unreal" ]; then + fn_getopt_unreal +else + fn_getopt_generic +fi \ No newline at end of file diff --git a/functions/fn_messages b/functions/core_messages.sh similarity index 99% rename from functions/fn_messages rename to functions/core_messages.sh index a8d55cb5b..939e73889 100644 --- a/functions/fn_messages +++ b/functions/core_messages.sh @@ -2,7 +2,7 @@ # LGSM fn_messages function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Defines on-screen messages such as [ OK ] and how script logs look. diff --git a/functions/fn_debug_dev b/functions/dev_debug.sh similarity index 80% rename from functions/fn_debug_dev rename to functions/dev_debug.sh index 3e4b14d8c..ed92a90e3 100644 --- a/functions/fn_debug_dev +++ b/functions/dev_debug.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_debug_dev function +# LGSM dev_debug.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" if [ -f ".dev-debug" ]; then rm .dev-debug diff --git a/functions/fn_deps_detect b/functions/dev_detect_deps.sh similarity index 98% rename from functions/fn_deps_detect rename to functions/dev_detect_deps.sh index 93e11094b..03069ea8e 100644 --- a/functions/fn_deps_detect +++ b/functions/dev_detect_deps.sh @@ -2,13 +2,13 @@ # LGSM fn_dep_detect function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Detects dependencies the server binary requires. local modulename="Backup" -fn_check_root -fn_check_systemdir +check_root.sh +check_systemdir.sh cd "${executabledir}" if [ "${executable}" == "./hlds_run" ]; then executable=hlds_linux diff --git a/functions/fn_email b/functions/email.sh similarity index 95% rename from functions/fn_email rename to functions/email.sh index e24c5eb75..ba5d47717 100644 --- a/functions/fn_email +++ b/functions/email.sh @@ -1,15 +1,15 @@ #!/bin/bash -# LGSM fn_email function +# LGSM email.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Sends email notification if monitor picks up a failure. local modulename="Email" fn_printdots "Sending notification to ${email}" echo -en "\n" -fn_details_distro +info_distro.sh { echo -e "========================================\n${servicename} details\n========================================\n" echo -e "Service: ${servicename}" @@ -27,7 +27,7 @@ fn_details_distro echo -e "Avg Load${load}\n" echo -e "========================================\nLogs\n========================================\n" echo -e "Script log\n===================\n" - fn_details + command_details.sh }|sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"|tee "${scriptlogdir}/${servicename}-email.log" tail -25 "${scriptlog}" >> "${emaillog}" if [ ! -z "${consolelog}" ]; then diff --git a/functions/fn_email_test b/functions/email_test.sh similarity index 81% rename from functions/fn_email_test rename to functions/email_test.sh index f46924d53..388c17bf9 100644 --- a/functions/fn_email_test +++ b/functions/email_test.sh @@ -1,21 +1,21 @@ #!/bin/bash -# LGSM fn_email_test function +# LGSM email_test.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Sends a test email notification. local modulename="Email" -fn_check_root -fn_check_systemdir -fn_details_config +check_root.sh +check_systemdir.sh +info_config.sh if [ "${emailnotification}" = "on" ]; then fn_scriptlog "Sending test notification" subject="${servicename} Email Test Notification - Testing ${servername}" failurereason="Testing ${servicename} email notification" actiontaken="Sent test email...hello is this thing on?" - fn_email + email.sh else fn_printfailnl "Notifications not enabled" fn_scriptlog "Notifications not enabled" diff --git a/functions/fn_arma3fix b/functions/fix_arma3.sh similarity index 82% rename from functions/fn_arma3fix rename to functions/fix_arma3.sh index 756600e96..2240b0fb7 100644 --- a/functions/fn_arma3fix +++ b/functions/fix_arma3.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_arma3fix function +# LGSM fix_arma3.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Fixes line 63: 20150 Segmentation fault (core dumped) #488 diff --git a/functions/fn_csgofix b/functions/fix_csgo.sh similarity index 98% rename from functions/fn_csgofix rename to functions/fix_csgo.sh index 7a055fdb2..488149b0f 100644 --- a/functions/fn_csgofix +++ b/functions/fix_csgo.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_csgofix function +# LGSM fix_csgo.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Resolves various issues with csgo. diff --git a/functions/fn_install_glibcfix b/functions/fix_glibc.sh similarity index 98% rename from functions/fn_install_glibcfix rename to functions/fix_glibc.sh index 0db2c48eb..a19daeab0 100644 --- a/functions/fn_install_glibcfix +++ b/functions/fix_glibc.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_glibcfix function +# LGSM fix_glibc.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" fn_glibcfixmsg(){ echo "" diff --git a/functions/fn_insfix b/functions/fix_ins.sh similarity index 91% rename from functions/fn_insfix rename to functions/fix_ins.sh index 9d8c0041d..dfb12eafe 100644 --- a/functions/fn_insfix +++ b/functions/fix_ins.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_insfix function +# LGSM fix_ins.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Resolves various issues with Insurgency. diff --git a/functions/fn_functions b/functions/fn_functions index b2f161396..f6ea53f55 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -1,328 +1,20 @@ #!/bin/bash -# LGSM fn_functions function +# LGSM core_functions.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="251215" +lgsm_version="271215" -# Description: Defines all functions to allow download and execution of functions using fn_runfunction. -# This function is called first before any other function. Without this file other functions would not load. +# Description: Redirect to new core_functions.sh -fn_arma3fix(){ +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_backup(){ +core_getopt.sh(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_check_ip(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_logs(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_root(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_steamcmd(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_steamuser(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_systemdir(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_tmux(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_check_ts3status(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_console(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_compress_unreal2maps(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_compress_ut99maps(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_csgofix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_debug(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_details(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_details_config(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_details_distro(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_details_glibc(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_debug_dev(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_deps_detect(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_email(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_email_test(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_getopt(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_insfix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_logs(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_messages(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_monitor(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_monitor_query(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_restart(){ -local modulename="Restarting" -fn_details_config -fn_scriptlog "${servername}" -fn_stop -fn_start -} - -fn_start(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_stop(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_update_check(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_update_functions(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_update_dl(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_update_functions(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_validate(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -# -## Installer functions -# - -fn_autoinstall(){ -autoinstall=1 -fn_install -} - -fn_install(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_complete(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_config(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_glibcfix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_gsquery(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_gslt(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_header(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_kffix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_logs(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_retry(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_rofix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_serverdir(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_serverfiles(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_steamcmd(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_steamfix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ts3(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ts3db(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut2k4(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut2k4filesdl(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut2k4fix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut2k4key(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut99(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut99filesdl(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -fn_install_ut99fix(){ -functionfile="${FUNCNAME}" -fn_runfunction -} - -# Calls on-screen messages -fn_messages +core_functions.sh \ No newline at end of file diff --git a/functions/fn_getopt b/functions/fn_getopt index 8c6f93fb1..8b52e1865 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -1,427 +1,15 @@ #!/bin/bash -# LGSM fn_getopt function +# LGSM core_getopt.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" -# Description: getopt arguments. +# Description: Redirect to new core_getopt.sh -fn_getopt_generic(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - u|update) - fn_update_check;; - fu|force-update|update-restart) - forceupdate=1; - fn_update_check;; - uf|update-functions) - fn_update_functions;; - v|validate) - fn_validate;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - c|console) - fn_console;; - d|debug) - fn_debug;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - ai|auto-install) - fn_autoinstall;; - dd|depsdetect) - fn_deps_detect;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." - echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." - } | column -s $'\t' -t - esac -exit +core_getopt.sh(){ +# Functions are defined in core_functions.sh. +functionfile="${FUNCNAME}" +fn_runfunction } -fn_getopt_teamspeak3(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - u|update) - fn_update_check;; - uf|update-functions) - fn_update_functions;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - ai|auto-install) - fn_autoinstall;; - dd|depsdetect) - fn_deps_detect;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate\t\e[0mChecks and applies updates from teamspeak.com." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." - } | column -s $'\t' -t - esac -exit -} - -fn_getopt_mumble(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - uf|update-functions) - fn_update_functions;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - b|backup) - fn_backup;; - dev|dev-debug) - fn_debug_dev;; - console) - fn_console;; - d|debug) - fn_debug;; - dd|depsdetect) - fn_deps_detect;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - } | column -s $'\t' -t - esac -exit -} - -fn_getopt_gmodserver(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - u|update) - fn_update_check;; - fu|force-update|update-restart) - forceupdate=1; - fn_update_check;; - uf|update-functions) - fn_update_functions;; - v|validate) - fn_validate;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - c|console) - fn_console;; - d|debug) - fn_debug;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - ai|auto-install) - fn_autoinstall;; - dd|depsdetect) - fn_deps_detect;; - gc|gmod-content) - fn_content_gmod;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." - echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." - echo -e "\e[34mgmod-content\t\e[0mDownload gmod add-on content." - } | column -s $'\t' -t - esac -exit -} - -fn_getopt_unreal(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - uf|update-functions) - fn_update_functions;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - c|console) - fn_console;; - d|debug) - fn_debug;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - mc|map-compressor) - fn_compress_ut99maps;; - dd|depsdetect) - fn_deps_detect;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." - } | column -s $'\t' -t - esac -exit -} - - -fn_getopt_unreal2(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - u|update) - fn_update_check;; - fu|force-update|update-restart) - forceupdate=1; - fn_update_check;; - uf|update-functions) - fn_update_functions;; - v|validate) - fn_validate;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - c|console) - fn_console;; - d|debug) - fn_debug;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - ai|auto-install) - fn_autoinstall;; - dd|depsdetect) - fn_deps_detect;; - mc|map-compressor) - fn_compress_unreal2maps;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." - echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." - echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." - } | column -s $'\t' -t - esac -exit -} - - -fn_getopt_ut2k4(){ -case "$getopt" in - st|start) - fn_start;; - sp|stop) - fn_stop;; - r|restart) - fn_restart;; - uf|update-functions) - fn_update_functions;; - m|monitor) - fn_monitor;; - et|email-test) - fn_email_test;; - d|details) - fn_details;; - b|backup) - fn_backup;; - c|console) - fn_console;; - d|debug) - fn_debug;; - dev|dev-debug) - fn_debug_dev;; - i|install) - fn_install;; - mc|map-compressor) - fn_compress_ut99maps;; - dd|depsdetect) - fn_deps_detect;; - *) - echo "Usage: $0 [option]" - echo "${gamename} - Linux Game Server Manager - Version ${version}" - echo "http://gameservermanagers.com/${selfname}" - echo -e "" - echo -e "\e[93mCommands\e[0m" - { - echo -e "\e[34mstart\t\e[0mStart the server." - echo -e "\e[34mstop\t\e[0mStop the server." - echo -e "\e[34mrestart\t\e[0mRestart the server." - echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." - echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." - echo -e "\e[34memail-test\t\e[0mSends test monitor email." - echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." - echo -e "\e[34mbackup\t\e[0mCreate archive of the server." - echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." - echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." - echo -e "\e[34minstall\t\e[0mInstall the server." - echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps." - } | column -s $'\t' -t - esac -exit -} - -if [ "${gamename}" == "Mumble" ]; then - fn_getopt_mumble -elif [ "${gamename}" == "Teamspeak 3" ]; then - fn_getopt_teamspeak3 -elif [ "${engine}" == "unreal2" ]; then - if [ "${gamename}" == "Unreal Tournament 2004" ]; then - fn_getopt_ut2k4 - else - fn_getopt_unreal2 - fi -elif [ "${engine}" == "unreal" ]; then - fn_getopt_unreal -else - fn_getopt_generic -fi \ No newline at end of file +core_getopt.sh \ No newline at end of file diff --git a/functions/fn_details_config b/functions/info_config.sh similarity index 98% rename from functions/fn_details_config rename to functions/info_config.sh index 99ca6de23..a342e2a52 100644 --- a/functions/fn_details_config +++ b/functions/info_config.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_details_config function +# LGSM info_config.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Gets specific details from config files. @@ -210,24 +210,24 @@ elif [ "${engine}" == "realvirtuality" ]; then fi # port - if [ "${srvport}" != "" ]; then - port=${srvport} + if [ "${port}" != "" ]; then + port=${port} fi if [ ! -n "${port}" ]; then port="0" fi # query port - if [ "${srvport}" != "" ]; then - queryport=$((srvport+1)) + if [ "${port}" != "" ]; then + queryport=$((port+1)) fi if [ ! -n "${queryport}" ]; then queryport="0" fi # master port - if [ "${srvport}" != "" ]; then - masterport=$((srvport+2)) + if [ "${port}" != "" ]; then + masterport=$((port+2)) fi if [ ! -n "${masterport}" ]; then masterport="0" diff --git a/functions/fn_details_distro b/functions/info_distro.sh similarity index 95% rename from functions/fn_details_distro rename to functions/info_distro.sh index 71a586a0f..7dc40c549 100644 --- a/functions/fn_details_distro +++ b/functions/info_distro.sh @@ -1,11 +1,11 @@ #!/bin/bash -# LGSM fn_details_distro function +# LGSM info_distro.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="211215" +lgsm_version="271215" # Description: Variables providing useful info on the Operating System such as disk and performace info. -# Used for fn_details, fn_debug and fn_email. +# Used for command_details.sh, command_debug.sh and email.sh. ## Distro infomation # Returns architecture, kernel and distro/os. diff --git a/functions/fn_details_glibc b/functions/info_glibc.sh similarity index 94% rename from functions/fn_details_glibc rename to functions/info_glibc.sh index dc6efb427..481bafa7a 100644 --- a/functions/fn_details_glibc +++ b/functions/info_glibc.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_details_glibc function +# LGSM info_glibc.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: stores details on servers Glibc requirements. diff --git a/functions/fn_check_ts3status b/functions/info_ts3status.sh similarity index 79% rename from functions/fn_check_ts3status rename to functions/info_ts3status.sh index 6cabddb3b..c08f95f1d 100644 --- a/functions/fn_check_ts3status +++ b/functions/info_ts3status.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_check_ts3status function +# LGSM info_ts3status.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Checks the status of Teamspeak 3. diff --git a/functions/fn_install_complete b/functions/install_complete.sh similarity index 88% rename from functions/fn_install_complete rename to functions/install_complete.sh index a9690d5ac..1961fa0e4 100644 --- a/functions/fn_install_complete +++ b/functions/install_complete.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_complete function +# LGSM install_complete.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" if [ "${gamename}" == "Dont Starve Together" ]; then echo "" diff --git a/functions/fn_install_config b/functions/install_config.sh similarity index 99% rename from functions/fn_install_config rename to functions/install_config.sh index 1bee1451f..117f675e0 100644 --- a/functions/fn_install_config +++ b/functions/install_config.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_config function +# LGSM install_config.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="251215" +lgsm_version="271215" fn_defaultconfig(){ echo "creating ${servercfg} config file." diff --git a/functions/fn_install_ut2k4filesdl b/functions/install_dl_ut2k4.sh similarity index 87% rename from functions/fn_install_ut2k4filesdl rename to functions/install_dl_ut2k4.sh index c8cf07f6a..d8c930fa6 100644 --- a/functions/fn_install_ut2k4filesdl +++ b/functions/install_dl_ut2k4.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut2k4filesdl function +# LGSM install_dl_ut2k4.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Downloading Server Files" echo "=================================" @@ -21,7 +21,7 @@ if [ "${md5check}" != "d3f28c5245c4c02802d48e4f0ffd3e34" ]; then echo "MD5 checksum: FAILED!" read -p "Retry download? [y/N]" yn case $yn in - [Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; fn_install_ut2k4filesdl;; + [Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; install_dl_ut2k4.sh;; [Nn]* ) echo Exiting; exit;; * ) echo "Please answer yes or no.";; esac @@ -42,7 +42,7 @@ if [ "${md5check}" != "0fa447e05fe5a38e0e32adf171be405e" ]; then echo "MD5 checksum: FAILED!" read -p "Retry download? [y/N]" yn case $yn in - [Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; fn_install_ut2k4filesdl;; + [Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; install_dl_ut2k4.sh;; [Nn]* ) echo Exiting; exit;; * ) echo "Please answer yes or no.";; esac diff --git a/functions/fn_install_ut99filesdl b/functions/install_dl_ut99.sh similarity index 95% rename from functions/fn_install_ut99filesdl rename to functions/install_dl_ut99.sh index 364c34865..d77598d07 100644 --- a/functions/fn_install_ut99filesdl +++ b/functions/install_dl_ut99.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut99filesdl function +# LGSM install_dl_ut99.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Downloading Server Files" echo "=================================" diff --git a/functions/fn_install_kffix b/functions/install_fix_kf.sh similarity index 85% rename from functions/fn_install_kffix rename to functions/install_fix_kf.sh index b3e484a2f..324602ff5 100644 --- a/functions/fn_install_kffix +++ b/functions/install_fix_kf.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_kffix function +# LGSM install_fix_kf.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Applying ${gamename} Server Fixes" echo "=================================" @@ -19,9 +19,9 @@ echo "applying server name fix." sleep 1 echo "forcing server restart..." sleep 1 -fn_start +command_start.sh sleep 5 -fn_stop -fn_start +command_stop.sh +command_start.sh sleep 5 -fn_stop \ No newline at end of file +command_stop.sh \ No newline at end of file diff --git a/functions/fn_install_rofix b/functions/install_fix_ro.sh similarity index 85% rename from functions/fn_install_rofix rename to functions/install_fix_ro.sh index 9e636d50b..2fe53cb4f 100644 --- a/functions/fn_install_rofix +++ b/functions/install_fix_ro.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_rofix function +# LGSM install_fix_ro.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Applying ${gamename} Server Fixes" echo "=================================" @@ -19,9 +19,9 @@ echo "applying server name fix." sleep 1 echo "forcing server restart..." sleep 1 -fn_start +command_start.sh sleep 5 -fn_stop -fn_start +command_stop.sh +command_start.sh sleep 5 -fn_stop \ No newline at end of file +command_stop.sh \ No newline at end of file diff --git a/functions/fn_install_steamfix b/functions/install_fix_steam.sh similarity index 95% rename from functions/fn_install_steamfix rename to functions/install_fix_steam.sh index d94ce3e28..2a2d5d656 100644 --- a/functions/fn_install_steamfix +++ b/functions/install_fix_steam.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_steamfix function +# LGSM install_fix_steam.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" fn_steamclientfix(){ echo "" diff --git a/functions/fn_install_ut2k4fix b/functions/install_fix_ut2k4.sh similarity index 86% rename from functions/fn_install_ut2k4fix rename to functions/install_fix_ut2k4.sh index 825f4e703..e6b321463 100644 --- a/functions/fn_install_ut2k4fix +++ b/functions/install_fix_ut2k4.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut2k4fix function +# LGSM install_fix_ut2k4.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Applying ${gamename} Server Fixes" echo "=================================" @@ -24,9 +24,9 @@ echo -en "forcing server restart...\r" sleep 0.5 echo -en "\n" sleep 0.5 -fn_start +command_start.sh sleep 5 -fn_stop -fn_start +command_stop.sh +command_start.sh sleep 5 -fn_stop \ No newline at end of file +command_stop.sh \ No newline at end of file diff --git a/functions/fn_install_ut99fix b/functions/install_fix_ut99.sh similarity index 92% rename from functions/fn_install_ut99fix rename to functions/install_fix_ut99.sh index 1147934b0..dd16f921b 100644 --- a/functions/fn_install_ut99fix +++ b/functions/install_fix_ut99.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut99fix function +# LGSM install_fix_ut99.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Applying ${gamename} Server Fixes" echo "=================================" diff --git a/functions/fn_install_gslt b/functions/install_gslt.sh similarity index 95% rename from functions/fn_install_gslt rename to functions/install_gslt.sh index e03b356b1..5919fac33 100644 --- a/functions/fn_install_gslt +++ b/functions/install_gslt.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_gslt function +# LGSM install_gslt.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="091215" +lgsm_version="271215" # Description: Configures GSLT. diff --git a/functions/fn_install_gsquery b/functions/install_gsquery.sh similarity index 94% rename from functions/fn_install_gsquery rename to functions/install_gsquery.sh index 16b1534ee..a113ea829 100644 --- a/functions/fn_install_gsquery +++ b/functions/install_gsquery.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_gsquery function +# LGSM install_gsquery.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="221215" +lgsm_version="271215" fn_dlgsquery(){ cd "${rootdir}" diff --git a/functions/fn_install_header b/functions/install_header.sh similarity index 83% rename from functions/fn_install_header rename to functions/install_header.sh index c8c79e835..1ee637c77 100644 --- a/functions/fn_install_header +++ b/functions/install_header.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_header function +# LGSM install_header.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" clear echo "=================================" diff --git a/functions/fn_install_logs b/functions/install_logs.sh similarity index 95% rename from functions/fn_install_logs rename to functions/install_logs.sh index 7cb81e9ab..6496ad647 100644 --- a/functions/fn_install_logs +++ b/functions/install_logs.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_logs function +# LGSM install_logs.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" if [ "${checklogs}" != "1" ]; then echo "" diff --git a/functions/fn_install_retry b/functions/install_retry.sh similarity index 70% rename from functions/fn_install_retry rename to functions/install_retry.sh index e7a90cbb8..2e7697af5 100644 --- a/functions/fn_install_retry +++ b/functions/install_retry.sh @@ -1,13 +1,13 @@ #!/bin/bash -# LGSM fn_install_retry function +# LGSM install_retry.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" while true; do read -e -i "y" -p "Retry install? [Y/n]" yn case $yn in - [Yy]* ) fn_install; exit;; + [Yy]* ) command_install.sh; exit;; [Nn]* ) echo Exiting; exit;; * ) echo "Please answer yes or no.";; esac diff --git a/functions/fn_install_serverdir b/functions/install_serverdir.sh similarity index 88% rename from functions/fn_install_serverdir rename to functions/install_serverdir.sh index 1322cd7b0..fb9f713b6 100644 --- a/functions/fn_install_serverdir +++ b/functions/install_serverdir.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_serverdir function +# LGSM install_serverdir.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" echo "" echo "Server Directory" diff --git a/functions/fn_install_serverfiles b/functions/install_serverfiles.sh similarity index 77% rename from functions/fn_install_serverfiles rename to functions/install_serverfiles.sh index 295a586d1..e21ace3f7 100644 --- a/functions/fn_install_serverfiles +++ b/functions/install_serverfiles.sh @@ -1,13 +1,13 @@ #!/bin/bash -# LGSM fn_install_serverfiles function +# LGSM finstall_serverfiles.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" fn_steaminstallcommand(){ -fn_check_steamuser +check_steamuser.sh counter="0" -while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_install_serverfiles.tmp)" -ge "1" ]; do +while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .finstall_serverfiles.sh.tmp)" -ge "1" ]; do counter=$((counter+1)) cd "${rootdir}/steamcmd" if [ "${counter}" -le "10" ]; then @@ -27,7 +27,7 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)" fi if [ "${counter}" -ge "9" ]; then rm -rf "${rootdir}/steamcmd" - fn_check_steamcmd + check_steamcmd.sh fi # Detects if unbuffer command is available. @@ -37,15 +37,15 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)" if [ "${counter}" -le "4" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp fi elif [ "${counter}" -ge "5" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp fi fi elif [ "${counter}" -ge "11" ]; then @@ -61,10 +61,10 @@ if [ "${engine}" == "goldsource" ]; then counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp + ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp done fi -rm -f .fn_install_serverfiles.tmp +rm -f .finstall_serverfiles.sh.tmp } echo "" @@ -80,7 +80,7 @@ if [ -z "${autoinstall}" ]; then read -e -i "y" -p "Was the install successful? [Y/n]" yn case $yn in [Yy]* ) break;; - [Nn]* ) fn_install_retry;; + [Nn]* ) install_retry.sh;; * ) echo "Please answer yes or no.";; esac done diff --git a/functions/fn_install_steamcmd b/functions/install_steamcmd.sh similarity index 95% rename from functions/fn_install_steamcmd rename to functions/install_steamcmd.sh index f9edcc389..094310191 100644 --- a/functions/fn_install_steamcmd +++ b/functions/install_steamcmd.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_steamcmd function +# LGSM install_steamcmd.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Downloads SteamCMD on install. diff --git a/functions/fn_install_ts3 b/functions/install_ts3.sh similarity index 97% rename from functions/fn_install_ts3 rename to functions/install_ts3.sh index 3224667f7..3860fbc50 100644 --- a/functions/fn_install_ts3 +++ b/functions/install_ts3.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LGSM fn_install_ts3 function +# LGSM install_ts3.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="251215" +lgsm_version="271215" -fn_details_distro +info_distro.sh # Gets the teamspeak server architecture if [ "${arch}" == "x86_64" ]; then ts3arch="amd64" diff --git a/functions/fn_install_ts3db b/functions/install_ts3db.sh similarity index 79% rename from functions/fn_install_ts3db rename to functions/install_ts3db.sh index b1119ee52..f7654ce07 100644 --- a/functions/fn_install_ts3db +++ b/functions/install_ts3db.sh @@ -1,8 +1,9 @@ #!/bin/bash # LGSM fn_install_ts3_mariadb function # Author: Daniel Gibbs +# Contributor: PhilPhonic # Website: http://gameservermanagers.com -lgsm_version="251215" +lgsm_version="271215" fn_install_ts3db_mariadb(){ echo "" @@ -40,15 +41,19 @@ fn_install_ts3db_mariadb(){ sleep 1 } -echo "" -while true; do - read -e -i "n" -p "Do you want to use MariaDB/MySQL instead of sqlite (Database Server including user and database already has to be set up!)? [y/N]" yn - case $yn in - [Yy]* ) fn_install_ts3db_mariadb && break;; - [Nn]* ) break;; - * ) echo "Please answer yes or no.";; - esac -done +if [ -z "${autoinstall}" ]; then + echo "" + while true; do + read -e -i "n" -p "Do you want to use MariaDB/MySQL instead of sqlite (Database Server including user and database already has to be set up!)? [y/N]" yn + case $yn in + [Yy]* ) fn_install_ts3db_mariadb && break;; + [Nn]* ) break;; + * ) echo "Please answer yes or no.";; + esac + done +else +fn_printwarningnl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install" +fi ## Get privilege key echo "" diff --git a/functions/fn_install_ut2k4 b/functions/install_ut2k4.sh similarity index 91% rename from functions/fn_install_ut2k4 rename to functions/install_ut2k4.sh index a76cc3e19..fe4e428e4 100644 --- a/functions/fn_install_ut2k4 +++ b/functions/install_ut2k4.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut2k4 function +# LGSM install_ut2k4.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Installing ${gamename} Server" echo "=================================" @@ -18,7 +18,7 @@ while true; do read -p "Was the install successful? [y/N]" yn case $yn in [Yy]* ) break;; - [Nn]* ) fn_install_retry;; + [Nn]* ) install_retry.sh;; * ) echo "Please answer yes or no.";; esac done diff --git a/functions/fn_install_ut2k4key b/functions/install_ut2k4_key.sh similarity index 87% rename from functions/fn_install_ut2k4key rename to functions/install_ut2k4_key.sh index 63e7c58be..10143a736 100644 --- a/functions/fn_install_ut2k4key +++ b/functions/install_ut2k4_key.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut2k4key function +# LGSM install_ut2k4_key.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Enter ${gamename} CD Key" echo "=================================" diff --git a/functions/fn_install_ut99 b/functions/install_ut99.sh similarity index 90% rename from functions/fn_install_ut99 rename to functions/install_ut99.sh index f37472880..c1b5a91a5 100644 --- a/functions/fn_install_ut99 +++ b/functions/install_ut99.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_install_ut99 function +# LGSM install_ut99.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" echo "Installing ${gamename} Server" echo "=================================" @@ -18,7 +18,7 @@ while true; do read -p "Was the install successful? [y/N]" yn case $yn in [Yy]* ) break;; - [Nn]* ) fn_install_retry;; + [Nn]* ) install_retry.sh;; * ) echo "Please answer yes or no.";; esac done diff --git a/functions/fn_logs b/functions/logs.sh similarity index 97% rename from functions/fn_logs rename to functions/logs.sh index d5b650bc0..ecca143c0 100644 --- a/functions/fn_logs +++ b/functions/logs.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_logs function +# LGSM logs.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Acts as a log rotater, removing old logs. diff --git a/functions/fn_monitor_query b/functions/monitor_gsquery.sh similarity index 96% rename from functions/fn_monitor_query rename to functions/monitor_gsquery.sh index 3bfb5077f..55e2e9fc2 100644 --- a/functions/fn_monitor_query +++ b/functions/monitor_gsquery.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_monitor_query function +# LGSM monitor_gsquery.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: uses gsquery.py to directly query the server. # Detects if the server has frozen. @@ -49,14 +49,14 @@ if [ -f "${rootdir}/gsquery.py" ]; then sleep 30 fi secondquery=1 - fn_monitor_query + monitor_gsquery.sh fi if [ "${emailnotification}" = "on" ]; then - fn_details_config + info_config.sh subject="${servicename} Monitor - Starting ${servername}" failurereason="Failed to query ${servicename}: ${serverquery}" actiontaken="restarted ${servicename}" - fn_email + email.sh fi fn_restart exit 1 @@ -74,7 +74,7 @@ if [ -f "${rootdir}/gsquery.py" ]; then echo "Attempting to resolve automatically" chmod +x -v "${rootdir}/gsquery.py" if [ $? -eq 0 ]; then - fn_monitor_query + monitor_gsquery.sh else fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n" owner=$(ls -al ${rootdir}/gsquery.py|awk '{ print $3 }') diff --git a/functions/fn_update_check b/functions/update_check.sh similarity index 95% rename from functions/fn_update_check rename to functions/update_check.sh index 551f4f4aa..f1b9ae78a 100644 --- a/functions/fn_update_check +++ b/functions/update_check.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_update_check function +# LGSM update_check.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="201215" +lgsm_version="271215" # Description: Checks if a server update is available. @@ -49,8 +49,8 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then fn_printinfonl "Forcing update to correct issue" fn_scriptlog "Forcing update to correct issue" sleep 1 - fn_update_dl - fn_update_check + update_dl.sh + update_check.sh fi elif [ "${appmanifestfilewc}" -eq "0" ]; then if [ "${forceupdate}" == "1" ]; then @@ -65,8 +65,8 @@ elif [ "${appmanifestfilewc}" -eq "0" ]; then fn_printinfonl "Forcing update to correct issue" fn_scriptlog "Forcing update to correct issue" sleep 1 - fn_update_dl - fn_update_check + update_dl.sh + update_check.sh fi } @@ -89,11 +89,11 @@ if [ "${requestrestart}" -ge "1" ]; then echo -ne "\n" tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_stop - fn_update_dl - fn_start + command_stop.sh + update_dl.sh + command_start.sh else - fn_update_dl + update_dl.sh fi else fn_printok "Checking for update: Server logs: No update requested" @@ -102,8 +102,8 @@ fi } fn_steamcmdcheck(){ -fn_check_steamcmd -fn_check_steamuser +check_steamcmd.sh +check_steamuser.sh fn_appmanifestcheck # Checks for server update from SteamCMD fn_printdots "Checking for update: SteamCMD" @@ -158,11 +158,11 @@ if [ "${currentbuild}" != "${availablebuild}" ]; then tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_stop - fn_update_dl - fn_start + command_stop.sh + update_dl.sh + command_start.sh else - fn_update_dl + update_dl.sh fi else echo -e "\n" @@ -197,8 +197,8 @@ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then fn_printinfonl "Checking for update: teamspeak.com: Forcing server restart" fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart" sleep 2 - fn_stop - fn_start + command_stop.sh + command_start.sh sleep 2 # If still failing will exit if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then @@ -274,16 +274,16 @@ if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then fn_scriptlog "Current build: ${currentbuild}" fn_scriptlog "Available build: ${availablebuild}" fn_scriptlog "${currentbuild} > ${availablebuild}" - fn_check_ts3status + info_ts3status.sh if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then - fn_update_dl - fn_start + update_dl.sh + command_start.sh sleep 5 - fn_stop + command_stop.sh else - fn_stop - fn_update_dl - fn_start + command_stop.sh + update_dl.sh + command_start.sh fi else echo -e "\n" @@ -297,7 +297,7 @@ else fi } -fn_check_logs +check_logs.sh fn_printdots "Checking for update" if [ "${gamename}" == "Teamspeak 3" ]; then fn_teamspeak3_check @@ -306,11 +306,11 @@ elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then # forceupdate bypasses checks tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_stop - fn_update_dl - fn_start + command_stop.sh + update_dl.sh + command_start.sh else - fn_update_dl + update_dl.sh fi else fn_logupdaterequest diff --git a/functions/fn_update_dl b/functions/update_dl.sh similarity index 94% rename from functions/fn_update_dl rename to functions/update_dl.sh index 835727cd0..aa9fc51b2 100644 --- a/functions/fn_update_dl +++ b/functions/update_dl.sh @@ -1,17 +1,17 @@ #!/bin/bash -# LGSM fn_update_dl function +# LGSM update_dl.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Runs a server update. local modulename="Update" fn_steamcmd_dl(){ -fn_check_root -fn_check_systemdir -fn_details_config +check_root.sh +check_systemdir.sh +info_config.sh fn_printdots "Updating ${servername}" sleep 1 fn_printoknl "Updating ${servername}" @@ -34,14 +34,14 @@ fi if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then echo -e '\n' - fn_csgofix + fix_csgo.sh fi } fn_teamspeak3_dl(){ -fn_check_root -fn_check_systemdir -fn_details_config +check_root.sh +check_systemdir.sh +info_config.sh fn_printdots "Updating ${servername}" sleep 1 fn_printoknl "Updating ${servername}" diff --git a/functions/fn_update_functions b/functions/update_functions.sh similarity index 87% rename from functions/fn_update_functions rename to functions/update_functions.sh index c000578d0..746db023a 100644 --- a/functions/fn_update_functions +++ b/functions/update_functions.sh @@ -1,8 +1,8 @@ #!/bin/bash -# LGSM fn_update_functions function +# LGSM update_functions.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="061115" +lgsm_version="271215" # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index c9926eb06..61b326506 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://gameservermanagers.com -version="071115" +version="271215" #### Variables #### @@ -25,6 +25,13 @@ parms="" #### Advanced Variables #### +# Github Branch Select +# Allows for the use of different function files +# from a different repo and/or branch. +githubuser="dgibbs64" +githubrepo="linuxgsm" +githubbranch="$TRAVIS_BRANCH" + # Steam appid="261140" @@ -35,7 +42,7 @@ engine="avalanche" # Directories rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" -selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}")) +selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" @@ -63,29 +70,56 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M- ##### 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 +fn_getgithubfile(){ +filename=$1 +exec=$2 +fileurl=${3:-$filename} +filepath="${rootdir}/${filename}" +filedir=$(dirname "${filepath}") +# If the function file is missing, then download +if [ ! -f "${filepath}" ]; then + if [ ! -d "${filedir}" ]; then + mkdir "${filedir}" + fi + githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" + echo -e " fetching ${filename}...\c" + if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then + : + else + echo -e "\e[0;31mFAIL\e[0m\n" + echo "Curl is not installed!" + echo -e "" + exit 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}" + curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) + if [ $? -ne 0 ]; then + echo -e "\e[0;31mFAIL\e[0m\n" + echo "${curl}" + echo -e "${githuburl}\n" + exit + else + echo -e "\e[0;32mOK\e[0m" + fi + if [ "${exec}" ]; then + chmod +x "${filepath}" + fi +fi +if [ "${exec}" ]; then + source "${filepath}" fi -source "${rootdir}/functions/${functionfile}" } -fn_functions(){ -# Functions are defined in fn_functions. +fn_runfunction(){ + fn_getgithubfile "functions/${functionfile}" 1 +} + +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh fn_currentstatus_tmux(){ pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:") @@ -118,9 +152,9 @@ fn_setstatus(){ echo -ne "New status: ${currentstatus}\\r" if [ "${requiredstatus}" == "ONLINE" ]; then - (fn_start > /dev/null 2>&1) + (command_start.sh > /dev/null 2>&1) else - (fn_stop > /dev/null 2>&1) + (command_stop.sh > /dev/null 2>&1) fi if [ "${counter}" -gt "5" ]; then currentstatus="FAIL" @@ -148,6 +182,7 @@ sleep 1 echo "=================================" echo "Server Tests" echo "Using: ${gamename}" +echo "Testing Branch: $TRAVIS_BRANCH" echo "=================================" echo "" sleep 1 @@ -160,7 +195,7 @@ echo "=================================" echo "Description:" echo "test script reaction to missing server files." echo "" -(fn_start) +(command_start.sh) echo "" echo "Test complete!" sleep 1 @@ -170,7 +205,7 @@ echo "=================================" echo "Description:" echo "displaying options messages." echo "" -(fn_getopt) +(core_getopt.sh) echo "" echo "Test complete!" sleep 1 @@ -196,7 +231,7 @@ echo "Description:" echo "start ${gamename} server." requiredstatus="OFFLINE" fn_setstatus -fn_start +command_start.sh echo "" echo "Test complete!" sleep 1 @@ -207,7 +242,7 @@ echo "Description:" echo "start ${gamename} server while already running." requiredstatus="ONLINE" fn_setstatus -(fn_start) +(command_start.sh) echo "" echo "Test complete!" sleep 1 @@ -220,7 +255,7 @@ requiredstatus="OFFLINE" fn_setstatus ( updateonstart="on" - fn_start + command_start.sh ) echo "" echo "Test complete!" @@ -232,7 +267,7 @@ echo "Description:" echo "stop ${gamename} server." requiredstatus="ONLINE" fn_setstatus -fn_stop +command_stop.sh echo "" echo "Test complete!" sleep 1 @@ -243,7 +278,7 @@ echo "Description:" echo "stop ${gamename} server while already stopped." requiredstatus="OFFLINE" fn_setstatus -(fn_stop) +(command_stop.sh) echo "" echo "Test complete!" sleep 1 @@ -279,7 +314,7 @@ echo "Description:" echo "check for updates." requiredstatus="OFFLINE" fn_setstatus -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -292,7 +327,7 @@ requiredstatus="OFFLINE" fn_setstatus fn_printinfonl "changed buildid to 0." sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -305,7 +340,7 @@ requiredstatus="ONLINE" fn_setstatus fn_printinfonl "changed buildid to 0." sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -318,7 +353,7 @@ requiredstatus="OFFLINE" fn_setstatus fn_printinfonl "removed appmanifest_${appid}.acf." rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf" -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -329,7 +364,7 @@ echo "Description:" echo "force-update bypassing update check." requiredstatus="OFFLINE" fn_setstatus -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -340,7 +375,7 @@ echo "Description:" echo "force-update bypassing update check server while already running." requiredstatus="ONLINE" fn_setstatus -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -351,7 +386,7 @@ echo "Description:" echo "validate server files." requiredstatus="OFFLINE" fn_setstatus -fn_validate +command_validate.sh echo "" echo "Test complete!" sleep 1 @@ -362,7 +397,7 @@ echo "Description:" echo "validate server files while server while already running." requiredstatus="ONLINE" fn_setstatus -fn_validate +command_validate.sh echo "" echo "Test complete!" sleep 1 @@ -376,7 +411,7 @@ echo "Description:" echo "run monitor server while already running." requiredstatus="ONLINE" fn_setstatus -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -387,7 +422,7 @@ echo "Description:" echo "run monitor while server is offline with no lockfile." requiredstatus="OFFLINE" fn_setstatus -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -400,7 +435,7 @@ requiredstatus="OFFLINE" fn_setstatus fn_printinfonl "creating lockfile." date > "${rootdir}/${lockselfname}" -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -412,10 +447,10 @@ echo "gsquery.py will fail to query port." requiredstatus="ONLINE" fn_setstatus sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" -(fn_monitor) +(command_monitor.sh) echo "" fn_printinfonl "Reseting ${servercfg}." -fn_install_config +install_config.sh echo "" echo "Test complete!" sleep 1 @@ -429,7 +464,7 @@ echo "Description:" echo "display details." requiredstatus="ONLINE" fn_setstatus -fn_details +command_details.sh echo "" echo "Test complete!" sleep 1 @@ -447,3 +482,4 @@ fn_printinfo "Tidying up directories." sleep 1 rm -rfv ${serverfiles} echo "END" + diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 783f544bb..b3207c368 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -22,7 +22,7 @@ servicename="ts3-server" # Directories rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" -selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}")) +selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" @@ -31,8 +31,10 @@ executable="./ts3server_startscript.sh" servercfg="${servicename}.ini" servercfgdir="${filesdir}" servercfgfullpath="${servercfgdir}/${servercfg}" +servercfgdefault="${servercfgdir}/lgsm-default.ini" backupdir="${rootdir}/backups" + # Logging logdays="7" gamelogdir="${filesdir}/logs" @@ -43,32 +45,68 @@ emaillog="${scriptlogdir}/${servicename}-email.log" scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log" +#### Advanced Variables #### + +# Github Branch Select +# Allows for the use of different function files +# from a different repo and/or branch. +githubuser="dgibbs64" +githubrepo="linuxgsm" +githubbranch="$TRAVIS_BRANCH" + ##### 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 +fn_getgithubfile(){ +filename=$1 +exec=$2 +fileurl=${3:-$filename} +filepath="${rootdir}/${filename}" +filedir=$(dirname "${filepath}") +# If the function file is missing, then download +if [ ! -f "${filepath}" ]; then + if [ ! -d "${filedir}" ]; then + mkdir "${filedir}" + fi + githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" + echo -e " fetching ${filename}...\c" + if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then + : + else + echo -e "\e[0;31mFAIL\e[0m\n" + echo "Curl is not installed!" + echo -e "" + exit 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}" + curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) + if [ $? -ne 0 ]; then + echo -e "\e[0;31mFAIL\e[0m\n" + echo "${curl}" + echo -e "${githuburl}\n" + exit + else + echo -e "\e[0;32mOK\e[0m" + fi + if [ "${exec}" ]; then + chmod +x "${filepath}" + fi +fi +if [ "${exec}" ]; then + source "${filepath}" fi -source "${rootdir}/functions/${functionfile}" } -fn_functions(){ -# Functions are defined in fn_functions. +fn_runfunction(){ + fn_getgithubfile "functions/${functionfile}" 1 +} + +core_functions.sh(){ +# Functions are defined in core_functions.sh. functionfile="${FUNCNAME}" fn_runfunction } -fn_functions +core_functions.sh fn_currentstatus_tmux(){ pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:") @@ -101,9 +139,9 @@ fn_setstatus(){ echo -ne "New status: ${currentstatus}\\r" if [ "${requiredstatus}" == "ONLINE" ]; then - (fn_start) + (command_start.sh) else - (fn_stop) + (command_stop.sh) fi if [ "${counter}" -gt "5" ]; then currentstatus="FAIL" @@ -142,7 +180,7 @@ echo "=================================" echo "Description:" echo "test script reaction to missing server files." echo "" -(fn_start) +(command_start.sh) echo "" echo "Test complete!" sleep 1 @@ -152,7 +190,7 @@ echo "=================================" echo "Description:" echo "displaying options messages." echo "" -(fn_getopt) +(core_getopt.sh) echo "" echo "Test complete!" sleep 1 @@ -178,7 +216,7 @@ echo "Description:" echo "start ${gamename} server." requiredstatus="OFFLINE" fn_setstatus -fn_start +command_start.sh echo "" echo "Test complete!" sleep 1 @@ -189,7 +227,7 @@ echo "Description:" echo "start ${gamename} server while already running." requiredstatus="ONLINE" fn_setstatus -(fn_start) +(command_start.sh) echo "" echo "Test complete!" sleep 1 @@ -202,7 +240,7 @@ requiredstatus="OFFLINE" fn_setstatus ( updateonstart="on" - fn_start + command_start.sh ) echo "" echo "Test complete!" @@ -214,7 +252,7 @@ echo "Description:" echo "stop ${gamename} server." requiredstatus="ONLINE" fn_setstatus -fn_stop +command_stop.sh echo "" echo "Test complete!" sleep 1 @@ -225,7 +263,7 @@ echo "Description:" echo "stop ${gamename} server while already stopped." requiredstatus="OFFLINE" fn_setstatus -(fn_stop) +(command_stop.sh) echo "" echo "Test complete!" sleep 1 @@ -261,7 +299,7 @@ echo "Description:" echo "check for updates." requiredstatus="OFFLINE" fn_setstatus -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -273,7 +311,7 @@ echo "change the version number tricking LGSM to update." requiredstatus="OFFLINE" sed -i 's/[0-9]\+/0/g' ${gamelogdir}/ts3server*_0.log fn_setstatus -fn_update_check +update_check.sh echo "" echo "Test complete!" sleep 1 @@ -285,7 +323,7 @@ echo "Description:" echo "run monitor server while already running." requiredstatus="ONLINE" fn_setstatus -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -296,7 +334,7 @@ echo "Description:" echo "run monitor while server is offline with no lockfile." requiredstatus="OFFLINE" fn_setstatus -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -309,7 +347,7 @@ requiredstatus="OFFLINE" fn_setstatus fn_printinfonl "creating lockfile." date > "${rootdir}/${lockselfname}" -(fn_monitor) +(command_monitor.sh) echo "" echo "Test complete!" sleep 1 @@ -321,10 +359,10 @@ echo "gsquery.py will fail to query port." requiredstatus="ONLINE" fn_setstatus sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" -(fn_monitor) +(command_monitor.sh) echo "" fn_printinfonl "Reseting ${servercfg}." -fn_install_config +install_config.sh echo "" echo "Test complete!" sleep 1 @@ -338,7 +376,7 @@ echo "Description:" echo "display details." requiredstatus="ONLINE" fn_setstatus -fn_details +command_details.sh echo "" echo "Test complete!" sleep 1