diff --git a/7DaysToDie/sdtdserver b/7DaysToDie/sdtdserver
index b3112820c..8e04aea42 100644
--- a/7DaysToDie/sdtdserver
+++ b/7DaysToDie/sdtdserver
@@ -2,22 +2,29 @@
# 7 Days To Die
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -28,7 +35,7 @@ updateonstart="off"
# http://7daystodie.gamepedia.com/Server
fn_parms(){
-parms="-configfile=${servercfgfullpath} -dedicated"
+parms="-logfile ${gamelogdir}/output_log__`date +%Y-%m-%d__%H-%M-%S`.txt -quit -batchmode -nographics -dedicated -configfile=${servercfgfullpath}"
}
#### Advanced Variables ####
@@ -52,10 +59,12 @@ engine="unity3d"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
-executable="./startserver.sh"
+executable="./7DaysToDieServer.x86"
servercfg="${servicename}.xml"
servercfgdir="${filesdir}"
servercfgfullpath="${servercfgdir}/${servercfg}"
@@ -67,6 +76,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -79,57 +89,63 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
- fi
- 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}"
+ exit 1
fi
+ chmod +x "${filedir}/${filename}"
fi
-if [ "${exec}" ]; then
- source "${filepath}"
-fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
core_getopt.sh
-
diff --git a/ARKSurvivalEvolved/arkserver b/ARKSurvivalEvolved/arkserver
index 2304ef566..30f34b568 100644
--- a/ARKSurvivalEvolved/arkserver
+++ b/ARKSurvivalEvolved/arkserver
@@ -2,22 +2,29 @@
# ARK: Survivial Evolved
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -51,6 +58,8 @@ engine="unreal4"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/ShooterGame"
executabledir="${systemdir}/Binaries/Linux"
@@ -66,6 +75,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -77,55 +87,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Arma3/arma3server b/Arma3/arma3server
index ff296e3bc..cf720bb0e 100644
--- a/Arma3/arma3server
+++ b/Arma3/arma3server
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributor: Scarsz
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -71,6 +78,8 @@ engine="realvirtuality"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -89,6 +98,7 @@ logdays="7"
#gamelogdir="" # No server logs available
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -100,55 +110,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/BlackMesa/bmdmserver b/BlackMesa/bmdmserver
index d31b067fc..48ae9673e 100644
--- a/BlackMesa/bmdmserver
+++ b/BlackMesa/bmdmserver
@@ -2,22 +2,29 @@
# Black Mesa: Deathmatch
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -33,7 +40,7 @@ updateonstart="off"
# Optional: Game Server Login Token
# GSLT can be used for running a public server.
-# More info: http://gameservermanagers.com/gslt
+# More info: https://gameservermanagers.com/gslt
gslt=""
# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
@@ -62,6 +69,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/bms"
executabledir="${filesdir}"
@@ -77,6 +86,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -88,55 +98,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/BladeSymphony/bsserver b/BladeSymphony/bsserver
index 87f1ff2ee..4dc07246f 100644
--- a/BladeSymphony/bsserver
+++ b/BladeSymphony/bsserver
@@ -2,22 +2,29 @@
# Blade Symphony
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/berimbau"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/BrainBread2/bb2server b/BrainBread2/bb2server
index df17a46f9..2aa450534 100644
--- a/BrainBread2/bb2server
+++ b/BrainBread2/bb2server
@@ -2,22 +2,29 @@
# BrainBread 2
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="090116"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -33,7 +40,7 @@ updateonstart="off"
# Optional: Game Server Login Token
# GSLT can be used for running a public server.
-# More info: http://gameservermanagers.com/gslt
+# More info: https://gameservermanagers.com/gslt
gslt=""
# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
@@ -62,6 +69,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/brainbread2"
executabledir="${filesdir}"
@@ -77,6 +86,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -88,55 +98,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/CodenameCURE/ccserver b/CodenameCURE/ccserver
index a80d57b2d..ab8ab009f 100644
--- a/CodenameCURE/ccserver
+++ b/CodenameCURE/ccserver
@@ -2,22 +2,29 @@
# Codename CURE
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/cure"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/CounterStrike/csserver b/CounterStrike/csserver
index 4fa7104d8..04cc4aa6c 100644
--- a/CounterStrike/csserver
+++ b/CounterStrike/csserver
@@ -2,22 +2,29 @@
# Counter Strike
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/cstrike"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/CounterStrikeConditionZero/csczserver b/CounterStrikeConditionZero/csczserver
index a6eca599c..e0cbc3d21 100644
--- a/CounterStrikeConditionZero/csczserver
+++ b/CounterStrikeConditionZero/csczserver
@@ -2,22 +2,29 @@
# Counter Strike: Condition Zero
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/czero"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver
index 64c2b0993..f2662d5c6 100755
--- a/CounterStrikeGlobalOffensive/csgoserver
+++ b/CounterStrikeGlobalOffensive/csgoserver
@@ -2,22 +2,29 @@
# Counter Strike: Global Offensive
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -44,7 +51,7 @@ updateonstart="off"
# Required: Game Server Login Token
# GSLT is required for running a public server.
-# More info: http://gameservermanagers.com/gslt
+# More info: https://gameservermanagers.com/gslt
gslt=""
# Optional: Workshop Parameters
@@ -80,6 +87,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/csgo"
executabledir="${filesdir}"
@@ -95,6 +104,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -106,55 +116,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver
index 3efde2766..814e1cf71 100644
--- a/CounterStrikeSource/cssserver
+++ b/CounterStrikeSource/cssserver
@@ -2,22 +2,29 @@
# Counter Strike: Source
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/cstrike"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/DayOfDefeat/dodserver b/DayOfDefeat/dodserver
index 88ea3b92a..6612fb477 100644
--- a/DayOfDefeat/dodserver
+++ b/DayOfDefeat/dodserver
@@ -2,22 +2,29 @@
# Day of Defeat
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dod"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver
index 5d80d01b0..d4d2d05f0 100644
--- a/DayOfDefeatSource/dodsserver
+++ b/DayOfDefeatSource/dodsserver
@@ -2,22 +2,29 @@
# Day of Defeat: Source
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dod"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/DeathmatchClassic/dmcserver b/DeathmatchClassic/dmcserver
index 0b9efa02a..ecee9ab39 100644
--- a/DeathmatchClassic/dmcserver
+++ b/DeathmatchClassic/dmcserver
@@ -2,22 +2,29 @@
# Deathmatch Classic
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dmc"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/DontStarveTogether/dstserver b/DontStarveTogether/dstserver
index f6b0afe42..c118ee466 100644
--- a/DontStarveTogether/dstserver
+++ b/DontStarveTogether/dstserver
@@ -2,22 +2,29 @@
# Dont Starve Together
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="130516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -26,12 +33,12 @@ steampass=""
ip="0.0.0.0"
updateonstart="off"
-
# Overworld: -conf_dir DST_Overworld
# Cave: -conf_dir DST_Cave
#http://dont-starve-game.wikia.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers
fn_parms(){
-parms=""
+parms="-console -cluster MyDediServer -shard Master"
+# -console -cluster MyDediServer -shard Master
}
#### Advanced Variables ####
@@ -55,6 +62,8 @@ engine="dontstarve"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}/bin"
@@ -70,6 +79,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -81,55 +91,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
- fi
- 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}"
+ exit 1
fi
+ chmod +x "${filedir}/${filename}"
fi
-if [ "${exec}" ]; then
- source "${filepath}"
-fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/DoubleActionBoogaloo/dabserver b/DoubleActionBoogaloo/dabserver
index 00b8c70f6..05f624dbe 100644
--- a/DoubleActionBoogaloo/dabserver
+++ b/DoubleActionBoogaloo/dabserver
@@ -2,22 +2,29 @@
# Double Action: Boogaloo
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -49,7 +56,7 @@ githubbranch="master"
appid="317800"
# Server Details
-servicename="da-server"
+servicename="dab-server"
gamename="Double Action: Boogaloo"
engine="source"
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dab"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/FistfulOfFrags/fofserver b/FistfulOfFrags/fofserver
index eaa85694f..668f65810 100644
--- a/FistfulOfFrags/fofserver
+++ b/FistfulOfFrags/fofserver
@@ -2,22 +2,29 @@
# Fistful Of Frags
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/fof"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver
index e3784c343..ea4c85292 100644
--- a/GarrysMod/gmodserver
+++ b/GarrysMod/gmodserver
@@ -2,22 +2,29 @@
# Garry's Mod
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="130316"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -44,7 +51,7 @@ customparms="+r_hunkalloclightmaps 0"
# Optional: Game Server Login Token
# GSLT can be used for running a public server.
-# More info: http://gameservermanagers.com/gslt
+# More info: https://gameservermanagers.com/gslt
gslt=""
# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
@@ -73,6 +80,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/garrysmod"
addonsdir="${systemdir}/addons"
@@ -89,6 +98,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -100,55 +110,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/GoldenEyeSource/gesserver b/GoldenEyeSource/gesserver
index f473dcc57..778c69a43 100644
--- a/GoldenEyeSource/gesserver
+++ b/GoldenEyeSource/gesserver
@@ -2,24 +2,30 @@
# GoldenEye: Source
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
-
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
export MALLOC_CHECK_=0
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -59,6 +65,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/gesource"
executabledir="${filesdir}"
@@ -74,6 +82,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -85,56 +94,63 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
- fi
- 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}"
+ exit 1
fi
+ chmod +x "${filedir}/${filename}"
fi
-if [ "${exec}" ]; then
- source "${filepath}"
-fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
-core_getopt.sh
\ No newline at end of file
+core_getopt.sh
diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver
index 271a024ef..b3cd29604 100644
--- a/HalfLife2Deathmatch/hl2dmserver
+++ b/HalfLife2Deathmatch/hl2dmserver
@@ -2,22 +2,29 @@
# Half Life 2: Deathmatch
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/hl2mp"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/HalfLifeDeathmatch/hldmserver b/HalfLifeDeathmatch/hldmserver
index b74914da1..ab75a9efe 100644
--- a/HalfLifeDeathmatch/hldmserver
+++ b/HalfLifeDeathmatch/hldmserver
@@ -2,22 +2,29 @@
# Half Life: Deathmatch
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -56,6 +63,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/valve"
executabledir="${filesdir}"
@@ -71,6 +80,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -82,55 +92,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/HalfLifeDeathmatchSource/hldmsserver b/HalfLifeDeathmatchSource/hldmsserver
index 33b2d0723..40dc54266 100644
--- a/HalfLifeDeathmatchSource/hldmsserver
+++ b/HalfLifeDeathmatchSource/hldmsserver
@@ -2,22 +2,29 @@
# Half-Life Deathmatch: Source
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/hl1mp"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Hurtworld/hwserver b/Hurtworld/hwserver
index 3a019f6d5..4c93d73e2 100644
--- a/Hurtworld/hwserver
+++ b/Hurtworld/hwserver
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs,
# Contributor: UltimateByte
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -43,6 +50,7 @@ loadsave=""
# Use unstable 64 bit server executable (O/1)
x64mode="0"
+
# http://hurtworld.wikia.com/wiki/Hosting_A_Server
fn_parms(){
parms="-batchmode -nographics -exec \"host ${port} ${map} ${loadsave};queryport ${queryport};maxplayers ${maxplayers};servername ${servername};creativemode ${creativemode};${admins}\" -logfile \"${logfile}\" "
@@ -69,6 +77,8 @@ engine="unity3d"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -84,6 +94,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -96,57 +107,63 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
- if [ $? -ne 0 ]; then
- echo -e "\e[0;31mFAIL\e[0m\n"
- echo " ${curl}"|grep "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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
core_getopt.sh
-
diff --git a/Insurgency/insserver b/Insurgency/insserver
index 66e511149..7f337536e 100644
--- a/Insurgency/insserver
+++ b/Insurgency/insserver
@@ -2,22 +2,29 @@
# Insurgency
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -59,6 +66,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/insurgency"
executabledir="${filesdir}"
@@ -74,6 +83,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -85,55 +95,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/JustCause2/jc2server b/JustCause2/jc2server
index 5435a3121..5db3b0a10 100644
--- a/JustCause2/jc2server
+++ b/JustCause2/jc2server
@@ -2,22 +2,29 @@
# Just Cause 2
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -50,6 +57,9 @@ engine="avalanche"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -65,6 +75,7 @@ logdays="7"
#gamelogdir="" # No server logs available
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -76,55 +87,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver
index 2aa5af27b..5380e71d8 100644
--- a/KillingFloor/kfserver
+++ b/KillingFloor/kfserver
@@ -2,22 +2,29 @@
# Killing Floor
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -56,6 +63,8 @@ engine="unreal2"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -85,55 +95,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Left4Dead/l4dserver b/Left4Dead/l4dserver
index 519ab1379..d70fce9f3 100644
--- a/Left4Dead/l4dserver
+++ b/Left4Dead/l4dserver
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributor: Summit Singh Thakur
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/left4dead"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server
index 6c966cb6e..12a29437f 100644
--- a/Left4Dead2/l4d2server
+++ b/Left4Dead2/l4d2server
@@ -2,22 +2,32 @@
# Left 4 Dead 2
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
+# Pushover
+#Push alot
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -56,6 +66,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/left4dead2"
executabledir="${filesdir}"
@@ -71,6 +83,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -82,55 +95,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
- fi
- 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}"
+ exit 1
fi
+ chmod +x "${filedir}/${filename}"
fi
-if [ "${exec}" ]; then
- source "${filepath}"
-fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Mumble/mumbleserver b/Mumble/mumbleserver
index c0bfa4692..11a531f6a 100644
--- a/Mumble/mumbleserver
+++ b/Mumble/mumbleserver
@@ -2,22 +2,29 @@
# Mumble
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Server Details
gamename="Mumble"
servicename="mumble-server"
@@ -26,6 +33,8 @@ servicename="mumble-server"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -40,6 +49,7 @@ logdays="7"
logdir="${rootdir}/log"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -62,57 +72,63 @@ githubbranch="master"
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
- fi
- 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}"
+ exit 1
fi
+ chmod +x "${filedir}/${filename}"
fi
-if [ "${exec}" ]; then
- source "${filepath}"
-fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
core_getopt.sh
-
diff --git a/NS2Combat/ns2cserver b/NS2Combat/ns2cserver
index a5683bf81..4b4628724 100644
--- a/NS2Combat/ns2cserver
+++ b/NS2Combat/ns2cserver
@@ -2,22 +2,29 @@
# NS2: Combat
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="220416"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -32,8 +39,6 @@ servername="NS2C Server"
webadminuser="admin"
webadminpass="admin"
webadminport="8080"
-configpath="server1"
-modstorage="server1/Workshop"
mods=""
password=""
# Add the following line to the parms if you want a private server. Ensuring
@@ -42,7 +47,7 @@ password=""
# http://wiki.unknownworlds.com/ns2/Dedicated_Server
fn_parms(){
-parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${rootdir}/${configpath}\" -modstorage \"${rootdir}/${modstorage}\" -mods \"${mods}\""
+parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${servercfgdir}\" -modstorage \"${modstoragedir}\" -mods \"${mods}\""
}
#### Advanced Variables ####
@@ -66,10 +71,15 @@ engine="spark"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}/ia32"
executable="./ns2combatserver_linux32"
+servercfgdir="${rootdir}/server1"
+servercfgfullpath="${servercfgdir}"
+modstoragedir="${servercfgdir}/Workshop"
backupdir="${rootdir}/backups"
# Logging
@@ -77,6 +87,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -88,55 +99,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server
index d53651b7f..a89192c53 100644
--- a/NaturalSelection2/ns2server
+++ b/NaturalSelection2/ns2server
@@ -2,22 +2,29 @@
# Natural Selection 2
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="220416"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -32,8 +39,6 @@ servername="NS2 Server"
webadminuser="admin"
webadminpass="admin"
webadminport="8080"
-configpath="server1"
-modstorage="server1/Workshop"
mods=""
password=""
# Add the following line to the parms if you want a private server. Ensuring
@@ -42,7 +47,7 @@ password=""
# http://wiki.unknownworlds.com/ns2/Dedicated_Server
fn_parms(){
-parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${rootdir}/${configpath}\" -modstorage \"${rootdir}/${modstorage}\" -mods \"${mods}\""
+parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${servercfgdir}\" -modstorage \"${modstoragedir}\" -mods \"${mods}\""
}
#### Advanced Variables ####
@@ -66,10 +71,15 @@ engine="spark"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
executable="./server_linux32"
+servercfgdir="${rootdir}/server1"
+servercfgfullpath="${servercfgdir}"
+modstoragedir="${servercfgdir}/Workshop"
backupdir="${rootdir}/backups"
# Logging
@@ -77,6 +87,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -88,55 +99,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver
index 26c836f2d..878bf985e 100644
--- a/NoMoreRoomInHell/nmrihserver
+++ b/NoMoreRoomInHell/nmrihserver
@@ -2,22 +2,29 @@
# No More Room in Hell
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/nmrih"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/OpposingForce/opforserver b/OpposingForce/opforserver
index 61e9b4128..9be4d6573 100644
--- a/OpposingForce/opforserver
+++ b/OpposingForce/opforserver
@@ -2,22 +2,29 @@
# Half-Life: Opposing Force
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/gearbox"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/PiratesVikingandKnightsII/pvkiiserver b/PiratesVikingandKnightsII/pvkiiserver
index 5a4588753..85ac0c1ff 100644
--- a/PiratesVikingandKnightsII/pvkiiserver
+++ b/PiratesVikingandKnightsII/pvkiiserver
@@ -2,22 +2,29 @@
# No More Room in Hell
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/pvkii"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/ProjectZomboid/cfg/servertest.ini b/ProjectZomboid/cfg/lgsm-default.ini
similarity index 100%
rename from ProjectZomboid/cfg/servertest.ini
rename to ProjectZomboid/cfg/lgsm-default.ini
diff --git a/ProjectZomboid/pzserver b/ProjectZomboid/pzserver
index d719944cd..9bf5284cd 100644
--- a/ProjectZomboid/pzserver
+++ b/ProjectZomboid/pzserver
@@ -3,25 +3,32 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributions: Bryce Van Dyk (SingingTree)
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
-steampass="password"
+steampass=""
# Start Variables
ip="0.0.0.0"
@@ -55,6 +62,8 @@ engine="projectzomboid"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -62,6 +71,7 @@ executable="./start-server.sh"
servercfg="servertest.ini"
servercfgdir="${HOME}/Zomboid/Server"
servercfgfullpath="${servercfgdir}/${servercfg}"
+servercfgdefault="${servercfgdir}/lgsm-default.ini"
backupdir="${rootdir}/backups"
# Logging
@@ -69,6 +79,7 @@ logdays="7"
gamelogdir="${HOME}/Zomboid/Logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -80,55 +91,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/QuakeLive/qlserver b/QuakeLive/qlserver
index 3e8246d3d..f47aee840 100755
--- a/QuakeLive/qlserver
+++ b/QuakeLive/qlserver
@@ -2,32 +2,39 @@
# Quake Live
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="190216"
+version="060516"
#### Variables ####
-arch="x64"
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
# Start Variables
-gameport="27960"
+arch="x64" # x64 or x86
+port="27960"
rconport="28960"
rconpassword="CHANGE_ME"
-statsport="${gameport}"
+statsport="${port}"
statspassword="CHANGE_ME"
mappool='mappool.txt'
ip="0.0.0.0"
@@ -36,7 +43,7 @@ updateonstart="off"
# Install/Config Guide : https://steamcommunity.com/sharedfiles/filedetails/?id=542966946
# Console Commands : http://www.regurge.at/ql/
fn_parms(){
- parms="+set net_strict 1 +set net_ip ${ip} +set net_port ${gameport} +set fs_homepath ${filesdir}/${gameport} +set zmq_rcon_enable 1 +set zmq_rcon_port ${rconport} +set zmq_rcon_password ${rconpassword} +set zmq_stats_enable 1 +set zmq_stats_password ${statspassword} +set zmq_stats_port ${statsport} +set sv_mapPoolFile ${mappool} +exec ${servercfg} "
+ parms="+set net_strict 1 +set net_ip ${ip} +set net_port ${port} +set fs_homepath ${filesdir}/${port} +set zmq_rcon_enable 1 +set zmq_rcon_port ${rconport} +set zmq_rcon_password ${rconpassword} +set zmq_stats_enable 1 +set zmq_stats_password ${statspassword} +set zmq_stats_port ${statsport} +set sv_mapPoolFile ${mappool} +exec ${servercfg}"
}
#### Advanced Variables ####
@@ -60,10 +67,12 @@ engine="idtech3"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
-executable=$([ "$arch" == 'x64' ] && echo "./run_server_x64.sh" || echo "./run_server_x86.sh")
+executable=$([ "${arch}" == 'x64' ] && echo "./run_server_x64.sh" || echo "./run_server_x86.sh")
servercfg="${servicename}.cfg"
servercfgdir="${filesdir}/baseq3"
servercfgfullpath="${servercfgdir}/${servercfg}"
@@ -75,6 +84,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -87,55 +97,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/README.md b/README.md
index 6b7056b55..6d395dafb 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
Linux Game Server Managers_
-
+
[](https://travis-ci.org/dgibbs64/linuxgsm)
[](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.
+The Linux Game Server Managers are command line tools for quick, simple deployment and management of various dedicated game servers and voice alert servers.
Hassle-Free Dedicated Servers
Game servers traditionally are not easy to manage yourself. Admins often have to spend hours just messing around trying to get their server working. LGSM is designed to be a simple as possible allowing Admins to spend less time on management and more time on the fun stuff.
@@ -15,7 +15,8 @@ Game servers traditionally are not easy to manage yourself. Admins often have to
Console
Details
Installer (SteamCMD)
- Monitor (including email notification)
+ Monitor
+ Alerts (Email, Pushbullet)
Update (SteamCMD)
Start/Stop/Restart server
@@ -38,11 +39,11 @@ All FAQ can be found here.
Donate
If you want to donate to the project you can via PayPal, Flattr or Gratipay. I have had a may kind people show their support by sending me a donation. Any donations you send help cover my server costs and buy me a drink. Cheers!
Useful Links
- - Homepage
+ - Homepage
- Wiki
- GitHub Code
- GitHub Issues
diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver
index 4e6424814..cccaa7aeb 100644
--- a/RedOrchestra/roserver
+++ b/RedOrchestra/roserver
@@ -2,22 +2,29 @@
# Red Orchestra: Ostfront 41-45
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -52,6 +59,8 @@ appid="223250"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/system"
executabledir="${systemdir}"
@@ -68,6 +77,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -81,55 +91,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Ricochet/ricochetserver b/Ricochet/ricochetserver
index 555c1b39b..e59d5c777 100644
--- a/Ricochet/ricochetserver
+++ b/Ricochet/ricochetserver
@@ -2,22 +2,29 @@
# Ricochet
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/ricochet"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Rust/cfg/lgsm-default.cfg b/Rust/cfg/lgsm-default.cfg
index 91d7a32d9..6d5ed99f8 100644
--- a/Rust/cfg/lgsm-default.cfg
+++ b/Rust/cfg/lgsm-default.cfg
@@ -14,7 +14,7 @@ server.description "LGSM Server\nRust support : UltimateByte"
server.headerimage "https://github.com/dgibbs64/linuxgsm/raw/master/images/logo/lgsm-full-light.png"
# The URL to your servers website.
-server.url "http://gameservermanagers.com/"
+server.url "https://gameservermanagers.com/"
####################################
# Optional Settings You Can Change #
diff --git a/Rust/rustserver b/Rust/rustserver
index 8d98109f0..23666b39c 100644
--- a/Rust/rustserver
+++ b/Rust/rustserver
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributor: UltimateByte (LGSM adaptation), Wulf (Information)
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="230215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login (not required)
steamuser="anonymous"
steampass=""
@@ -74,6 +81,8 @@ engine="unity3d"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -90,6 +99,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -103,55 +113,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
- if [ $? -ne 0 ]; then
- echo -e "\e[0;31mFAIL\e[0m\n"
- echo " ${curl}"|grep "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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/SeriousSam3BFE/ss3sserver b/SeriousSam3BFE/ss3sserver
index 0ffefc5e8..cad500dc1 100644
--- a/SeriousSam3BFE/ss3sserver
+++ b/SeriousSam3BFE/ss3sserver
@@ -2,22 +2,29 @@
# Serious Sam 3: BFE
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="121215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -52,6 +59,8 @@ engine="seriousengine35"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/Bin"
executable="./runSam3_DedicatedServer.sh"
@@ -67,6 +76,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -80,55 +90,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/StarBound/sbserver b/StarBound/sbserver
index c8253a643..3837c6213 100644
--- a/StarBound/sbserver
+++ b/StarBound/sbserver
@@ -2,22 +2,29 @@
# Starbound
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -51,6 +58,8 @@ engine="starbound"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}/linux64"
@@ -65,6 +74,7 @@ logdays="7"
gamelogdir="${filesdir}/giraffe_storage"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -76,55 +86,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/SvenCoop/svencoopserver b/SvenCoop/svencoopserver
index f4abfc4c5..f58719276 100644
--- a/SvenCoop/svencoopserver
+++ b/SvenCoop/svencoopserver
@@ -2,22 +2,29 @@
# Sven Co-op
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -56,6 +63,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/svencoop"
executabledir="${filesdir}"
@@ -71,6 +80,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -82,56 +92,63 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
-core_getopt.sh
\ No newline at end of file
+core_getopt.sh
diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server
index 984817ab0..3a13f4a37 100644
--- a/TeamFortress2/tf2server
+++ b/TeamFortress2/tf2server
@@ -2,22 +2,29 @@
# Team Fortress 2
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -33,7 +40,7 @@ updateonstart="off"
# Optional: Game Server Login Token
# GSLT can be used for running a public server.
-# More info: http://gameservermanagers.com/gslt
+# More info: https://gameservermanagers.com/gslt
gslt=""
# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
@@ -62,6 +69,8 @@ engine="source"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/tf"
executabledir="${filesdir}"
@@ -77,6 +86,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -88,55 +98,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/TeamFortressClassic/tfcserver b/TeamFortressClassic/tfcserver
index 82f4583ff..fa05c0a1d 100644
--- a/TeamFortressClassic/tfcserver
+++ b/TeamFortressClassic/tfcserver
@@ -2,22 +2,29 @@
# Team Fortress Classic
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="anonymous"
steampass=""
@@ -57,6 +64,8 @@ engine="goldsource"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/tfc"
executabledir="${filesdir}"
@@ -72,6 +81,7 @@ logdays="7"
gamelogdir="${systemdir}/logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -83,55 +93,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/TeamSpeak3/ts3server b/TeamSpeak3/ts3server
index 311474c30..7cf1c88ca 100644
--- a/TeamSpeak3/ts3server
+++ b/TeamSpeak3/ts3server
@@ -2,22 +2,29 @@
# Teamspeak 3
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="251215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Start Variables
updateonstart="off"
@@ -30,6 +37,8 @@ servicename="ts3-server"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -60,55 +69,62 @@ githubbranch="master"
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Teeworlds/twserver b/Teeworlds/twserver
index a051ebe9e..1cfc86b53 100644
--- a/Teeworlds/twserver
+++ b/Teeworlds/twserver
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributor: Bryce Van Dyk (SingingTree)
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -52,6 +59,8 @@ engine="teeworlds"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -67,6 +76,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -79,55 +89,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/Terraria/cfg/lgsm-default.txt b/Terraria/cfg/lgsm-default.txt
index d6258d4cf..9a907e61d 100644
--- a/Terraria/cfg/lgsm-default.txt
+++ b/Terraria/cfg/lgsm-default.txt
@@ -22,40 +22,40 @@
#remove the # in front of commands to enable them.
#Load a world and automatically start the server.
-#world=C:\Users\YOUR_USERNAME_HERE\My Documents\My Games\Terraria\Worlds\world1.wld
+world=~/.local/share/Terraria/Worlds/world1.wld
#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
-#autocreate=1
+autocreate=1
#Sets the name of the world when using autocreate
-#worldname=Terraria
+worldname=Terraria
#Sets the difficulty of the world when using autocreate 0(normal), 1(expert)
-#difficulty=1
+difficulty=0
#Sets the max number of players allowed on a server. Value must be between 1 and 255
-#maxplayers=8
+maxplayers=8
#Set the port number
-#port=7777
+port=7777
#Set the server password
-#password=p@55w0rd
+password=p@55w0rd
#Set the message of the day
-#motd=Please don’t cut the purple trees!
+motd=Please don’t cut the purple trees!
#Sets the folder where world files will be stored
-#worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\
+worldpath=~/.local/share/Terraria/Worlds/
#The location of the banlist. Defaults to "banlist.txt" in the working directory.
-#banlist=banlist.txt
+banlist=banlist.txt
#Adds addition cheat protection.
-#secure=1
+secure=1
#Sets the server language 1:English, 2:German, 3:Italian, 4:French, 5:Spanish
-#lang=1
+lang=1
#Automatically forward ports with uPNP
#upnp=1
diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver
index f8088bd16..51bc754b0 100644
--- a/Terraria/terrariaserver
+++ b/Terraria/terrariaserver
@@ -3,22 +3,29 @@
# Server Management Script
# Author: Daniel Gibbs
# Contributor: Bryce Van Dyk (SingingTree)
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Steam login
steamuser="username"
steampass="password"
@@ -52,6 +59,8 @@ engine="terraria"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
@@ -67,6 +76,7 @@ logdays="7"
#gamelogdir="" # Terraria Doesn't Have a Server Log
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -78,55 +88,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server
index d74310b30..fcdabc3c6 100644
--- a/UnrealTournament2004/ut2k4server
+++ b/UnrealTournament2004/ut2k4server
@@ -2,22 +2,29 @@
# Unreal Tournament 2004
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="271215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Start Variables
defaultmap="DM-Rankin"
ip="0.0.0.0"
@@ -35,6 +42,8 @@ engine="unreal2"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
@@ -51,6 +60,7 @@ logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
@@ -71,55 +81,62 @@ githubbranch="master"
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server
index a1dd53887..00055db8e 100644
--- a/UnrealTournament99/ut99server
+++ b/UnrealTournament99/ut99server
@@ -2,22 +2,29 @@
# Unreal Tournament 99
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
-version="121215"
+version="210516"
#### Variables ####
-# Notification Email
+# Notification Alerts
# (on|off)
-emailnotification="off"
+
+# Email
+emailalert="off"
email="email@example.com"
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert"off"
+pushbullettoken="accesstoken"
+
# Start Variables
defaultmap="DM-Deck16]["
ip="0.0.0.0"
@@ -28,6 +35,13 @@ parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
#### 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="master"
+
# Server Details
servicename="ut99-server"
gamename="Unreal Tournament 99"
@@ -37,6 +51,8 @@ engine="unreal"
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
@@ -50,8 +66,10 @@ backupdir="${rootdir}/backups"
# Logging
logdays="7"
+gamelogdir="${filesdir}/Logs"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
+consolelogging="on"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
@@ -60,65 +78,65 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
-# Github Branch Select
-# Allows for the use of different function files
-# from a different repo and/or branch.
-githubuser="dgibbs64"
-githubrepo="linuxgsm"
-githubbranch="master"
-
##### Script #####
# Do not edit
-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
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then
- mkdir "${filedir}"
+ mkdir -p "${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
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
- exit
+ exit 1
fi
- 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}"
+ chmod +x "${filedir}/${filename}"
fi
+source "${filedir}/${filename}"
}
-fn_runfunction(){
- fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
core_functions.sh(){
# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
+core_dl.sh
core_functions.sh
getopt=$1
diff --git a/functions/check_steamcmd.sh b/functions/check_steamcmd.sh
deleted file mode 100644
index cd8ab4f39..000000000
--- a/functions/check_steamcmd.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-# LGSM check_steamcmd.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="160316"
-
-# Description: Checks SteamCMD is installed and correct.
-
-
-fn_install_steamcmd(){
-echo "Installing steamCMD"
-if [ ! -d "${steamcmddir}" ]; then
- mkdir -v "${steamcmddir}"
-fi
-curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
-exitcode=$?
-echo -e "downloading steamcmd_linux.tar.gz...\c"
-if [ $exitcode -eq 0 ]; then
- fn_printokeol
-else
- fn_printfaileol
- echo "${curl}"
- echo -e "${githuburl}\n"
- exit $exitcode
-fi
-tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
-rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
-chmod +x "${steamcmddir}/steamcmd.sh"
-echo ""
-}
-
-
-fn_check_steamcmd_user(){
-# Checks steamuser is setup.
-if [ "${steamuser}" == "username" ]; then
- fn_printfailnl "Steam login not set. Update steamuser."
- echo " * Change steamuser=\"username\" to a valid steam login."
- if [ -d "${scriptlogdir}" ]; then
- fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
- exit 1
- fi
-fi
-# Anonymous user is set if steamuser is missing
-if [ -z "${steamuser}" ]; then
- fn_printwarnnl "Steam login not set. Using anonymous login."
- if [ -d "${scriptlogdir}" ]; then
- fn_scriptlog "Steam login not set. Using anonymous login."
- fi
- steamuser="anonymous"
- steampass=""
- sleep 2
-fi
-}
-
-fn_check_steamcmd_sh(){
-# Checks if SteamCMD exists when starting or updating a server.
-# Installs if missing.
-steamcmddir="${rootdir}/steamcmd"
-if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
- if [ "${function_selfname}" == "command_install.sh" ]; then
- fn_install_steamcmd
- else
- fn_printwarnnl "SteamCMD is missing"
- fn_scriptlog "SteamCMD is missing"
- sleep 1
- fn_install_steamcmd
- fi
-elif [ "${function_selfname}" == "command_install.sh" ]; then
- fn_printinfomation "SteamCMD is already installed..."
- fn_printokeol
-fi
-}
-
-fn_check_steamcmd_guard(){
-if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" == "command_validate.sh" ]; then
- # Checks that steamcmd is working correctly and will prompt Steam Guard if required.
- "${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
- if [ $? -ne 0 ]; then
- fn_printfailurenl "Error running SteamCMD"
- fi
-fi
-}
-
-if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Teamspeak 3" ]; then
- : # These servers do not require SteamCMD. Check is skipped.
-else
- fn_check_steamcmd_user
- fn_check_steamcmd_sh
- fn_check_steamcmd_guard
-fi
\ No newline at end of file
diff --git a/functions/check_steamuser.sh b/functions/check_steamuser.sh
deleted file mode 100644
index a807dc70e..000000000
--- a/functions/check_steamuser.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# LGSM check_steamuser.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-if [ "${steamuser}" == "username" ]; then
- fn_printfailnl "Steam login not set. Update steamuser."
- echo " * Change steamuser=\"username\" to a valid steam login."
- if [ -d ${scriptlogdir} ]; then
- fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
- exit 1
- fi
-fi
-if [ -z "${steamuser}" ]; then
- fn_printwarnnl "Steam login not set. Using anonymous login."
- if [ -d "${scriptlogdir}" ]; then
- fn_scriptlog "Steam login not set. Using anonymous login."
- fi
- steamuser="anonymous"
- steampass=""
- sleep 2
-fi
diff --git a/functions/command_details.sh b/functions/command_details.sh
deleted file mode 100644
index 4a481bc02..000000000
--- a/functions/command_details.sh
+++ /dev/null
@@ -1,681 +0,0 @@
-#!/bin/bash
-# LGSM command_details.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="230216"
-
-# Description: Displays server infomation.
-
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-# Standard Details
-# This applies to all engines
-
-fn_details_os(){
-echo -e ""
-echo -e "\e[93mDistro Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mDistro:\t\e[0m${os}"
- echo -e "\e[34mArch:\t\e[0m${arch}"
- echo -e "\e[34mKernel:\t\e[0m${kernel}"
- echo -e "\e[34mHostname:\t\e[0m$HOSTNAME"
- echo -e "\e[34mtmux:\t\e[0m${tmuxv}"
- echo -e "\e[34mGLIBC:\t\e[0m${glibcv}"
-} | column -s $'\t' -t
-}
-
-fn_details_performance(){
-echo -e ""
-echo -e "\e[93mPerformance\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m"
- echo -e "\e[34mAvg Load:\t\e[0m${load}"
-} | column -s $'\t' -t
-echo -e ""
-{
- echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m"
- echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m"
- echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m"
-} | column -s $'\t' -t
-}
-
-fn_details_disk(){
-echo -e ""
-echo -e "\e[93mStorage\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
- echo -e "\e[34mTotal:\t\e[0m${totalspace}"
- echo -e "\e[34mUsed:\t\e[0m${usedspace}"
- echo -e "\e[34mAvailable:\t\e[0m${availspace}"
- echo -e "\e[34mServerfiles:\t\e[0m${filesdirdu}"
- if [ -d "${backupdir}" ]; then
- echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
- fi
-} | column -s $'\t' -t
-}
-
-fn_details_gameserver(){
-echo -e ""
-
-## server details
-echo -e "\e[92m${gamename} Server Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- # server name
- echo -e "\e[34mServer name:\t\e[0m${servername}"
-
- # server ip
- echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}"
-
- # rcon password
- if [ -n "${rconpassword}" ]; then
- echo -e "\e[34mRCON password:\t\e[0m${rconpassword}"
- fi
-
- # server password
- if [ -n "${serverpassword}" ]; then
- echo -e "\e[34mServer password:\t\e[0m${serverpassword}"
- fi
-
- # admin password
- if [ -n "${adminpassword}" ]; then
- echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}"
- fi
-
- # slots
- if [ -n "${slots}" ]; then
- echo -e "\e[34mSlots:\t\e[0m${slots}"
- fi
-
- # game mode
- if [ -n "${gamemode}" ]; then
- echo -e "\e[34mGame mode:\t\e[0m${gamemode}"
- fi
-
- # game world
- if [ -n "${gameworld}" ]; then
- echo -e "\e[34mGame world:\t\e[0m${gameworld}"
- fi
-
- # tick rate
- if [ -n "${tickrate}" ]; then
- echo -e "\e[34mTick rate:\t\e[0m${tickrate}"
- fi
-
- # online status
- if [ "${gamename}" == "Teamspeak 3" ]; then
- 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
- echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
- fi
- else
- pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
- echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
- else
- echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
- fi
- fi
-
- # teamspeak dbplugin
- if [ -n "${dbplugin}" ]; then
- echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}"
- fi
-} | column -s $'\t' -t
-echo -e ""
-
-## script details
-echo -e "\e[92m${selfname} Script Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- # service name
- echo -e "\e[34mService name:\t\e[0m${servicename}"
-
- # script version
- if [ -n "${version}" ]; then
- echo -e "\e[34m${selfname} version:\t\e[0m${version}"
- fi
-
- # script user
- echo -e "\e[34mUser:\t\e[0m$(whoami)"
-
- # GLIBC required
- if [ -n "${glibcrequired}" ] && [ "${glibcrequired}" != "UNKNOWN" ]; then
- if [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt "$(echo "${glibcrequired}" | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" ]; then
- if [ "${glibcfix}" == "yes" ]; then
- echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)"
- else
- echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}\e[0m(\e[0;32mGLIBC version too old\e[0m)"
- fi
- else
- echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m"
- fi
- fi
-
- # email notification
- if [ -n "${emailnotification}" ]; then
- echo -e "\e[34mEmail notification:\t\e[0m${emailnotification}"
- fi
-
- # update on start
- if [ -n "${updateonstart}" ]; then
- echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}"
- fi
-
- # script location
- echo -e "\e[34mLocation:\t\e[0m${rootdir}"
-
- # config file location
- if [ -n "${servercfgfullpath}" ]; then
- echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}"
- fi
-
- # network config file location (ARMA 3)
- if [ -n "${networkcfgfullpath}" ]; then
- echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}"
- fi
-} | column -s $'\t' -t
-}
-
-fn_details_backup(){
-echo -e ""
-echo -e "\e[92mBackups\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
- echo -e "No Backups created"
-else
- {
- echo -e "\e[34mNo. of backups:\t\e[0m${backupcount}"
- echo -e "\e[34mLatest backup:\e[0m"
- echo -e "\e[34m date:\t\e[0m${lastbackupdate}"
- echo -e "\e[34m file:\t\e[0m${lastbackup}"
- echo -e "\e[34m size:\t\e[0m${lastbackupsize}"
- } | column -s $'\t' -t
-fi
-}
-
-fn_details_commandlineparms(){
-echo -e ""
-echo -e "\e[92mCommand-line Parameters\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "${executable} ${parms}"
-}
-
-fn_details_statusbottom(){
-echo -e ""
-if [ "${gamename}" == "Teamspeak 3" ]; then
- if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
- echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
- else
- echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
- fi
-else
- pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
- echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
- else
- echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
- fi
-fi
-echo -e ""
-}
-
-# Engine Specific details
-
-fn_details_avalanche(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep Jcmp-Server"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_dontstarve(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep dontstarve"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_projectzomboid(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep java"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-
-fn_details_realvirtuality(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep arma3server"
-echo -e ""
-if [ -z "${port}" ]||[ -z "${queryport}" ]||[ -z "${masterport}" ]; then
- echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
- echo -e ""
-fi
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\tudp"
- echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
- echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_idtech3(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep qzeroded"
-echo -e ""
-if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
- echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
- echo -e ""
-fi
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\tudp"
- echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
- echo -e "> Stats\tINBOUND\t${statsport}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-
-fn_details_seriousengine35(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep Sam3_Dedicate"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_source(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the command-line"
-echo -e "parameters in ${selfname}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep srcds_linux"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
- if [ -n "${sourcetvport}" ]; then
- echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
- fi
- echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_spark(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the command-line"
-echo -e "parameters in ${selfname}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep server_linux3"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
- echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
-} | column -s $'\t' -t
-echo -e ""
-echo -e "\e[92m${servername} WebAdmin\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}/index.html"
- echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
- echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_starbound(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the command-line"
-echo -e "parameters in ${selfname}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep starbound"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\ttcp"
- echo -e "> Query\tINBOUND\t${queryport}\ttcp"
- echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-
-}
-
-fn_details_teamspeak3(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep ts3server"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Voice\tINBOUND\t${port}\tudp"
- echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
- echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_teeworlds(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the command-line"
-echo -e "parameters in ${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep teeworlds_srv"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\ttcp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_terraria(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the command-line"
-echo -e "parameters in ${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep terraia"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game\tINBOUND\t${port}\ttcp"
- echo -e "> Query\tINBOUND\t${queryport}\ttcp"
- echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_sdtd(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep 7DaysToDie"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
- echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
- echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
-} | column -s $'\t' -t
-echo -e ""
-echo -e "\e[92m${servername} WebAdmin\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
- echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
- echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
-} | column -s $'\t' -t
-echo -e ""
-echo -e "\e[92m${servername} Telnet\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mTelnet enabled:\t\e[0m${telnetenabled}"
- echo -e "\e[34mTelnet address:\t\e[0m${ip} ${telnetport}"
- echo -e "\e[34mTelnet password:\t\e[0m${telnetpass}"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_hurtworld(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "hwserver script"
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep Hurtworld"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
-
-} | column -s $'\t' -t
-echo -e ""
-
-fn_details_statusbottom
-}
-
-fn_details_rust(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "rustserver script"
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep Rust"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
- echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
- echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
-
-} | column -s $'\t' -t
-echo -e ""
-
-fn_details_statusbottom
-}
-
-fn_details_unreal(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep ucc-bin"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
- echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
- if [ "${engine}" == "unreal" ]; then
- echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
- fi
- if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
- echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
- fi
- if [ "${appid}" == "215360" ]; then
- echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
- else
- echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
- fi
- if [ "${appid}" ]; then
- if [ "${appid}" == "223250" ]; then
- echo -e "< Steam\tOUTBOUND\t20610\tudp"
- else
- echo -e "< Steam\tOUTBOUND\t20660\tudp"
- fi
- fi
- echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
-} | column -s $'\t' -t
-echo -e ""
-echo -e "\e[92m${servername} WebAdmin\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
- echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
- echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
- echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-fn_details_ark(){
-echo -e ""
-echo -e "\e[92mPorts\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-echo -e "Change ports by editing the parameters in"
-echo -e "${servercfgfullpath}."
-echo -e ""
-echo -e "Useful port diagnostic command:"
-echo -e "netstat -atunp | grep ShooterGame"
-echo -e ""
-{
- echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
- echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
- echo -e "> Query\tINBOUND\t${queryport}\tudp"
-} | column -s $'\t' -t
-
-fn_details_statusbottom
-}
-
-
-# Run checks and gathers details to display.
-check.sh
-info_config.sh
-info_distro.sh
-info_glibc.sh
-fn_details_os
-fn_details_performance
-fn_details_disk
-fn_details_gameserver
-fn_details_backup
-# Some game servers do not have parms.
-if [ "${gamename}" != "Teamspeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
- fn_parms
- fn_details_commandlineparms
-fi
-
-# Display details depending on game or engine.
-if [ "${engine}" == "avalanche" ]; then
- fn_details_avalanche
-elif [ "${engine}" == "dontstarve" ]; then
- fn_details_dontstarve
-elif [ "${engine}" == "projectzomboid" ]; then
- fn_details_projectzomboid
-elif [ "${engine}" == "idtech3" ]; then
- fn_details_idtech3
-elif [ "${engine}" == "realvirtuality" ]; then
- fn_details_realvirtuality
-elif [ "${engine}" == "seriousengine35" ]; then
- fn_details_seriousengine35
-elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
- fn_details_source
-elif [ "${engine}" == "spark" ]; then
- fn_details_spark
-elif [ "${engine}" == "starbound" ]; then
- fn_details_starbound
-elif [ "${engine}" == "teeworlds" ]; then
- fn_details_teeworlds
-elif [ "${engine}" == "terraria" ]; then
- fn_details_terraria
-elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
- fn_details_unreal
-elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
- fn_details_ark
-elif [ "${gamename}" == "Hurtworld" ]; then
- fn_details_hurtworld
-elif [ "${gamename}" == "7 Days To Die" ]; then
- fn_details_sdtd
-elif [ "${gamename}" == "Teamspeak 3" ]; then
- fn_details_teamspeak3
-elif [ "${gamename}" == "Rust" ]; then
- fn_details_rust
-else
- fn_printerrornl "Unable to detect server engine."
-fi
diff --git a/functions/command_dev_debug.sh b/functions/command_dev_debug.sh
deleted file mode 100644
index e2c9d9cc5..000000000
--- a/functions/command_dev_debug.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# LGSM dev_debug.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="281215"
-
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-if [ -f ".dev-debug" ]; then
- rm .dev-debug
- fn_printoknl "Disabled dev-debug"
-else
- date > .dev-debug
- fn_printoknl "Enabled dev-debug"
-fi
\ No newline at end of file
diff --git a/functions/command_email_test.sh b/functions/command_email_test.sh
deleted file mode 100644
index b24ff3b01..000000000
--- a/functions/command_email_test.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# LGSM command_email_test.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Sends a test email notification.
-
-local modulename="Email"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-check.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?"
- email.sh
-else
- fn_printfailnl "Notifications not enabled"
- fn_scriptlog "Notifications not enabled"
-fi
\ No newline at end of file
diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh
deleted file mode 100644
index a509a14ae..000000000
--- a/functions/command_fastdl.sh
+++ /dev/null
@@ -1,335 +0,0 @@
-#!/bin/bash
-# LGSM command_fastdl function
-# Author: Daniel Gibbs
-# Contributor: UltimateByte
-# Website: http://gameservermanagers.com
-lgsm_version="210216"
-
-# Description: Creates a FastDL folder
-
-local modulename="FastDL"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-check.sh
-
-# Directories
-webdir="${rootdir}/www"
-fastdldir="${webdir}/fastdl"
-addonsdir="${systemdir}/addons"
-# Server lua autorun dir, used to autorun lua on client connect to the server
-luasvautorundir="${systemdir}/lua/autorun/server"
-luafastdlfile="lgsm_cl_force_fastdl.lua"
-luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
-
-fn_check_bzip2(){
-# Returns true if not installed
-if [ -z "$(command -v bzip2)" ]; then
- bzip2installed="0"
- fn_printinfo "bzip2 is not installed !"
- fn_scriptlog "bzip2 is not installed"
- echo -en "\n"
- sleep 1
- echo "We advise using it"
- echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/FastDL#bzip2-compression"
- sleep 2
-else
- bzip2installed="1"
-fi
-}
-
-fn_fastdl_init(){
-# User confirmation
-fn_printok "Welcome to LGSM's FastDL generator"
-sleep 1
-echo -en "\n"
-fn_scriptlog "Started FastDL creation"
-while true; do
- read -e -i "y" -p "Continue? [Y/n]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) exit;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-fn_scriptlog "Initiating FastDL creation"
-
-# Check and create folders
-if [ ! -d "${webdir}" ]; then
- echo ""
- fn_printinfo "Creating FastDL directories"
- echo -en "\n"
- sleep 1
- fn_printdots "Creating www directory"
- sleep 0.5
- mkdir "${webdir}"
- fn_printok "Created www directory"
- fn_scriptlog "FastDL created www directory"
- sleep 1
- echo -en "\n"
-fi
-if [ ! -d "${fastdldir}" ]; then
- # No folder, won't ask for removing old ones
- newfastdl=1
- fn_printdots "Creating fastdl directory"
- sleep 0.5
- mkdir "${fastdldir}"
- fn_printok "Created fastdl directory"
- fn_scriptlog "FastDL created fastdl directory"
- sleep 1
- echo -en "\n"
- clearoldfastdl="off" # Nothing to clear
-elif [ "$(ls -A "${fastdldir}")" ]; then
- newfastdl=0
-fi
-}
-
-fn_fastdl_config(){
-# Global settings for FastDL creation
-fn_printinfo "Entering configuration"
-fn_scriptlog "Configuration"
-sleep 2
-echo -en "\n"
-# Prompt for clearing old files if folder was already here
-if [ -n "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then
- fn_printdots
- while true; do
- read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn
- case $yn in
- [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;;
- [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;;
- * ) echo "Please answer yes or no.";;
- esac
- done
- echo -en "\n"
-fi
-# Prompt for using bzip2 if it's installed
-if [ ${bzip2installed} == 1 ]; then
- fn_printdots
- while true; do
- read -e -i "y" -p "Enable file compression using bzip2? [Y/n]" yn
- case $yn in
- [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;;
- [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled"; break;;
- * ) echo "Please answer yes or no.";;
- esac
- done
- echo -en "\n"
-fi
-}
-
-fn_fastdl_gmod_config(){
-# Prompt for download enforcer, that is using a .lua addfile resource generator
-fn_printdots
-while true; do
- read -e -i "y" -p "Use client download enforcer? [Y/n]" yn
- case $yn in
- [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;;
- [Nn]* ) luaressource="off"; fn_scriptlog "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-echo -en "\n"
-}
-
-fn_clear_old_fastdl(){
-# Clearing old FastDL if user answered yes
-if [ "${clearoldfastdl}" == "on" ]; then
- fn_printinfo "Clearing existing FastDL folder"
- fn_scriptlog "Clearing existing FastDL folder"
- sleep 0.5
- rm -R "${fastdldir:?}"/*
- fn_printok "Old FastDL folder cleared"
- fn_scriptlog "Old FastDL folder cleared"
- sleep 1
- echo -en "\n"
-fi
-}
-
-fn_gmod_fastdl(){
-# Copy all needed files for FastDL
-echo ""
-fn_printdots "Starting gathering all needed files"
-fn_scriptlog "Starting gathering all needed files"
-sleep 1
-echo -en "\n"
-
-# No choice to cd to the directory, as find can't then display relative folder
-cd "${systemdir}"
-
-# Map Files
-fn_printdots "Copying map files..."
-fn_scriptlog "Copying map files"
-sleep 0.5
-find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Map files copied"
-sleep 0.5
-echo -en "\n"
-
-# Materials
-fn_printdots "Copying materials..."
-fn_scriptlog "Copying materials"
-sleep 0.5
-find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Materials copied"
-sleep 0.5
-echo -en "\n"
-
-# Models
-fn_printdots "Copying models..."
-fn_scriptlog "Copying models"
-sleep 1
-find . -name '*.vtx' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.phy' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Models copied"
-sleep 0.5
-echo -en "\n"
-
-# Particles
-fn_printdots "Copying particles..."
-fn_scriptlog "Copying particles"
-sleep 0.5
-find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Particles copied"
-sleep 0.5
-echo -en "\n"
-
-# Sounds
-fn_printdots "Copying sounds..."
-fn_scriptlog "Copying sounds"
-sleep 0.5
-find . -name '*.wav' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Sounds copied"
-sleep 0.5
-echo -en "\n"
-
-# Resources (mostly fonts)
-fn_printdots "Copying fonts and png..."
-fn_scriptlog "Copying fonts and png"
-sleep 1
-find . -name '*.otf' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}"
-find . -name '*.png' | cpio --quiet -updm "${fastdldir}"
-fn_printok "Fonts and png copied"
-sleep 0.5
-echo -en "\n"
-
-# Going back to rootdir in order to prevent mistakes
-cd "${rootdir}"
-
-# Correct addons folder structure for FastDL
-if [ -d "${fastdldir}/addons" ]; then
- fn_printinfo "Adjusting addons' file structure"
- fn_scriptlog "Adjusting addon's file structure"
- sleep 1
- cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
-#Don't remove yet rm -R "${fastdldir:?}/addons"
- fn_printok "Adjusted addon's file structure"
- sleep 1
- echo -en "\n"
-fi
-
-# Correct content that may be into a lua folder by mistake like some darkrpmodification addons
-if [ -d "${fastdldir}/lua" ]; then
- fn_printdots "Typical DarkRP shit detected, fixing"
- sleep 2
- cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
- fn_printok "Stupid DarkRP file structure fixed"
- sleep 2
- echo -en "\n"
-fi
-}
-
-# Generate lua file that will force download any file into the FastDL folder
-fn_lua_fastdl(){
-# Remove lua file if luaressource is turned off and file exists
-echo ""
-if [ "${luaressource}" == "off" ]; then
- if [ -f "${luafastdlfullpath}" ]; then
- fn_printdots "Removing download enforcer"
- sleep 1
- rm -R "${luafastdlfullpath:?}"
- fn_printok "Removed download enforcer"
- fn_scriptlog "Removed old download inforcer"
- echo -en "\n"
- sleep 2
- fi
-fi
-# Remove old lua file and generate a new one if user said yes
-if [ "${luaressource}" == "on" ]; then
- if [ -f "${luafastdlfullpath}" ]; then
- fn_printdots "Removing old download enforcer"
- sleep 1
- rm "${luafastdlfullpath}"
- fn_printok "Removed old download enforcer"
- fn_scriptlog "Removed old download enforcer"
- echo -en "\n"
- sleep 1
- fi
- fn_printdots "Generating new download enforcer"
- fn_scriptlog "Generating new download enforcer"
- sleep 1
- # Read all filenames and put them into a lua file at the right path
- find "${fastdldir}" \( -type f ! -name "*.bz2" \) -printf '%P\n' | while read line; do
- echo "resource.AddFile( "\""${line}"\"" )" >> ${luafastdlfullpath}
- done
- fn_printok "Download enforcer generated"
- fn_scriptlog "Download enforcer generated"
- echo -en "\n"
- echo ""
- sleep 2
-fi
-}
-
-fn_fastdl_bzip2(){
-# Compressing using bzip2 if user said yes
-echo ""
-if [ ${bzip2enable} == "on" ]; then
- fn_printinfo "Have a break, this step could take a while..."
- echo -en "\n"
- echo ""
- fn_printdots "Compressing files using bzip2..."
- fn_scriptlog "Compressing files using bzip2..."
- # bzip2 all files that are not already compressed (keeping original files)
- find "${fastdldir}" \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{\} \;
- fn_printok "bzip2 compression done"
- fn_scriptlog "bzip2 compression done"
- sleep 1
- echo -en "\n"
-fi
-}
-
-fn_fastdl_completed(){
-# Finished message
-echo ""
-fn_printok "Congratulations, it's done !"
-fn_scriptlog "FastDL job done"
-sleep 2
-echo -en "\n"
-echo ""
-fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/FastDL"
-echo -en "\n"
-if [ "$bzip2installed" == "0" ]; then
-echo "By the way, you'd better install bzip2 an re-run this command !"
-fi
-echo "Credits : UltimateByte"
-}
-
-# Game checking and functions running
-# Garry's Mod
-if [ "${gamename}" == "Garry's Mod" ]; then
- fn_check_bzip2
- fn_fastdl_init
- fn_fastdl_config
- fn_fastdl_gmod_config
- fn_clear_old_fastdl
- fn_gmod_fastdl
- fn_lua_fastdl
- fn_fastdl_bzip2
- fn_fastdl_completed
- exit
-fi
diff --git a/functions/command_monitor.sh b/functions/command_monitor.sh
deleted file mode 100644
index 2d98683a3..000000000
--- a/functions/command_monitor.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/bash
-# LGSM command_monitor.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Monitors server by checking for running proccesses
-# then passes to monitor_gsquery.sh.
-
-local modulename="Monitor"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-fn_monitor_teamspeak3(){
-check.sh
-logs.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-if [ ! -f "${rootdir}/${lockselfname}" ]; then
- fn_printinfo "Disabled: No lock file found"
- fn_scriptlog "Disabled: No lock file found"
- sleep 1
- echo -en "\n"
- echo "To enable monitor run ./${selfname} start"
- exit 1
-fi
-fn_printdots "Checking session: CHECKING"
-fn_scriptlog "Checking session: CHECKING"
-sleep 1
-info_ts3status.sh
-if [ "${ts3status}" = "Server is running" ]; then
- fn_printok "Checking session: OK"
- fn_scriptlog "Checking session: OK"
- sleep 1
- sleep 0.5
- echo -en "\n"
- exit
-else
- fn_printfail "Checking session: FAIL"
- fn_scriptlog "Checking session: FAIL"
- sleep 1
- fn_printfail "Checking session: FAIL: ${ts3status}"
- fn_scriptlog "Checking session: FAIL: ${ts3status}"
- failurereason="${ts3status}"
- if [ "${emailnotification}" = "on" ]; then
- subject="${servicename} Monitor - Restarting ${servername}"
- actiontaken="restarted ${servername}"
- email.sh
- fi
-fi
-sleep 0.5
-echo -en "\n"
-fn_restart
-}
-
-fn_monitor_tmux(){
-check.sh
-info_config.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-if [ ! -f "${rootdir}/${lockselfname}" ]; then
- fn_printinfo "Disabled: No lock file found"
- fn_scriptlog "Disabled: No lock file found"
- sleep 1
- echo -en "\n"
- echo "To enable monitor run ./${selfname} start"
- exit 1
-fi
-
-updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)
-if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]; then
- fn_printdots "Checking session: CHECKING"
- fn_scriptlog "Checking session: CHECKING"
- sleep 1
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- if [ "${tmuxwc}" -eq 1 ]; then
- fn_printok "Checking session: OK"
- fn_scriptlog "Checking session: OK"
- sleep 1
- echo -en "\n"
-
- if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
- monitor_gsquery.sh
- fi
- exit $?
- else
- fn_printfail "Checking session: FAIL"
- fn_scriptlog "Checking session: FAIL"
- sleep 1
- echo -en "\n"
- if [ "${emailnotification}" = "on" ]; then
- subject="${servicename} Monitor - Starting ${servername}"
- failurereason="${servicename} process not running"
- actiontaken="${servicename} has been restarted"
- email.sh
- fi
- fn_scriptlog "Monitor is starting ${servername}"
- command_start.sh
- fi
-else
- fn_printinfonl "SteamCMD is currently checking for updates"
- fn_scriptlog "SteamCMD is currently checking for updates"
- sleep 1
- fn_printinfonl "When update is complete ${servicename} will start"
- fn_scriptlog "When update is complete ${servicename} will start"
- sleep 1
-fi
-}
-
-if [ "${gamename}" == "Teamspeak 3" ]; then
- fn_monitor_teamspeak3
-else
- fn_monitor_tmux
-fi
diff --git a/functions/command_start.sh b/functions/command_start.sh
deleted file mode 100644
index 5a6ae2569..000000000
--- a/functions/command_start.sh
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/bin/bash
-# LGSM command_start.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="070116"
-
-# Description: Starts the server.
-
-local modulename="Starting"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-fn_start_teamspeak3(){
-check.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
- update_check.sh
- fi
-fi
-
-if [ ! -e "${servercfgfullpath}" ]; then
- fn_printwarn "${servercfgfullpath} is missing"
- fn_scriptlog "${servercfgfullpath} is missing"
- sleep 2
- echo -en "\n"
- echo " * Creating blank ${servercfg}"
- fn_scriptlog "Creating blank ${servercfg}"
- sleep 2
- echo " * ${servercfg} can remain blank by default."
- fn_scriptlog "${servercfgfullpath} can remain blank by default."
- sleep 2
- echo " * ${servercfg} is located in ${servercfgfullpath}."
- fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
- sleep 5
- touch "${servercfgfullpath}"
-fi
-
-logs.sh
-
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-
-if [ "${ts3status}" == "Server is running" ]; then
- fn_printinfo "${servername} is already running"
- fn_scriptlog "${servername} is already running"
- sleep 1
- echo -en "\n"
- exit
-fi
-
-mv "${scriptlog}" "${scriptlogdate}"
-# Create lock file
-date > "${rootdir}/${lockselfname}"
-cd "${executabledir}"
-if [ "${ts3serverpass}" == "1" ];then
- ./ts3server_startscript.sh start serveradmin_password="${newpassword}" inifile="${servercfgfullpath}"
-else
- ./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
-fi
-sleep 1
-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}"
- echo -e " Check log files: ${rootdir}/log"
- exit 1
-else
- fn_printok "${servername}"
- fn_scriptlog "Started ${servername}"
-fi
-sleep 0.5
-echo -en "\n"
-}
-
-fn_start_tmux(){
-check.sh
-fix.sh
-info_config.sh
-fn_parms
-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
- update_check.sh
- fi
-fi
-
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-
-if [ "${tmuxwc}" -eq 0 ]; then
- fn_scriptlog "Rotating log files"
- if [ "${engine}" == "unreal2" ]; then
- mv "${gamelog}" "${gamelogdate}"
- fi
- mv "${scriptlog}" "${scriptlogdate}"
- mv "${consolelog}" "${consolelogdate}"
-fi
-
-if [ "${tmuxwc}" -eq 1 ]; then
- fn_printinfo "${servername} is already running"
- fn_scriptlog "${servername} is already running"
- sleep 1
- echo -en "\n"
- exit
-fi
-
-# Create lock file
-date > "${rootdir}/${lockselfname}"
-cd "${executabledir}"
-tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-# tmux pipe-pane not supported in tmux versions < 1.6
-if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
- echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
- echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
- echo "Currently installed: $(tmux -V)" >> "${consolelog}"
-elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
- echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
- echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
- echo "Currently installed: $(tmux -V)" >> "${consolelog}"
-else
- touch "${consolelog}"
- tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
-fi
-sleep 1
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-# If the server fails to start
-if [ "${tmuxwc}" -eq 0 ]; then
- fn_printfailnl "Unable to start ${servername}"
- fn_scriptlog "Unable to start ${servername}"
- sleep 1
- if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
- fn_printfailnl "Unable to start ${servername}: Tmux error:"
- fn_scriptlog "Tmux error"
- sleep 1
- echo -en "\n"
- echo ""
- echo "Command"
- echo "================================="
- echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\""
- echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" >> "${scriptlog}"
- echo ""
- echo "Error"
- echo "================================="
- cat "${scriptlogdir}/.${servicename}-tmux-error.tmp"
- cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
-
- # Detected error http://gameservermanagers.com/issues
- if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
- echo ""
- echo "Fix"
- echo "================================="
- if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ]; then
- echo "$(whoami) is not part of the tty group."
- fn_scriptlog "$(whoami) is not part of the tty group."
- group=$(grep tty /etc/group)
- echo ""
- echo " ${group}"
- fn_scriptlog "${group}"
- echo ""
- echo "Run the following command with root privileges."
- echo ""
- echo " usermod -G tty $(whoami)"
- echo ""
- echo "http://gameservermanagers.com/tmux-op-perm"
- fn_scriptlog "http://gameservermanagers.com/tmux-op-perm"
- else
- echo "No known fix currently. Please log an issue."
- fn_scriptlog "No known fix currently. Please log an issue."
- echo "http://gameservermanagers.com/issues"
- fn_scriptlog "http://gameservermanagers.com/issues"
- fi
- fi
- fi
-exit 1
-else
- fn_printok "${servername}"
- fn_scriptlog "Started ${servername}"
-fi
-rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-echo -en "\n"
-}
-
-if [ "${gamename}" == "Teamspeak 3" ]; then
- fn_start_teamspeak3
-else
- fn_start_tmux
-fi
diff --git a/functions/command_stop.sh b/functions/command_stop.sh
deleted file mode 100644
index 98d21c9a5..000000000
--- a/functions/command_stop.sh
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/bash
-# LGSM command_stop.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Stops the server.
-
-local modulename="Stopping"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-sdtd_telnet(){
- sdtdshutdown=$( expect -c '
- proc abort {} {
- puts "Timeout or EOF\n"
- exit 1
- }
- spawn telnet '"${telnetip}"' '"${telnetport}"'
- expect {
- "password:" { send "'"${telnetpass}"'\r" }
- default abort
- }
- expect {
- "session." { send "shutdown\r" }
- default abort
- }
- expect { eof }
- puts "Completed.\n"
- ')
-}
-
-fn_stop_teamspeak3(){
-check.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-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"
-else
- ${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1
- fn_printok "${servername}"
- fn_scriptlog "Stopped ${servername}"
-fi
-# Remove lock file
-rm -f "${rootdir}/${lockselfname}"
-sleep 1
-echo -en "\n"
-}
-
-fn_stop_tmux(){
-check.sh
-info_config.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-
-if [ "${gamename}" == "7 Days To Die" ] ; then
- # if game is 7 Days To Die, we need special, graceful shutdown via telnet connection.
- # Set below variable to be called for expect to operate correctly..
- fn_printdots "Attempting graceful shutdown via telnet"
- fn_scriptlog "Attempting graceful shutdown via telnet"
- sleep 1
- telnetip=127.0.0.1
- sdtd_telnet
-
- # If failed using localhost will use servers ip
- refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF")
- if [ -n "${refused}" ]; then
- telnetip=${ip}
- fn_printwarn "Attempting graceful shutdown via telnet: localhost failed"
- fn_scriptlog "Warning! Attempting graceful shutdown failed using localhost"
- sleep 5
- echo -en "\n"
- fn_printdots "Attempting graceful shutdown via telnet: using ${telnetip}"
- fn_scriptlog "Attempting graceful shutdown via telnet using ${telnetip}"
- sdtd_telnet
- sleep 1
- fi
-
- refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF")
- completed=$(echo -en "\n ${sdtdshutdown}"| grep "Completed.")
- if [ -n "${refused}" ]; then
- fn_printfail "Attempting graceful shutdown via telnet"
- fn_scriptlog "Attempting graceful shutdown failed"
- fn_scriptlog "${refused}"
- elif [ -n "${completed}" ]; then
- fn_printok "Attempting graceful shutdown via telnet"
- fn_scriptlog "Attempting graceful shutdown succeeded"
- else
- fn_printfail "Attempting graceful shutdown via telnet: Unknown error"
- fn_scriptlog "Attempting graceful shutdown failed"
- fn_scriptlog "Unknown error"
- fi
- sleep 1
- echo -en "\n\n"
- echo -en "Telnet output:"
- echo -en "\n ${sdtdshutdown}"
- echo -en "\n\n"
- sleep 1
- fn_printdots "${servername}"
- fn_scriptlog "${servername}"
- sleep 5
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
- fn_printok "${servername} is already stopped using graceful shutdown"
- fn_scriptlog "${servername} is already stopped using graceful shutdown"
- else
- tmux kill-session -t "${servicename}"
- fn_printok "${servername}"
- fn_scriptlog "Stopped ${servername}"
- fi
-
-else
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
- fn_printfail "${servername} is already stopped"
- fn_scriptlog "${servername} is already stopped"
- else
-
- if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
- sleep 1
- fn_printdots "Attempting graceful shutdown"
- fn_scriptlog "Attempting graceful shutdown"
- tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
- counter=0
- while [ "${pid}" != "0" -a $counter -lt 30 ]; do
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
- sleep 1
- let counter=counter+1
- if [ "${counter}" -gt "1" ]; then
- fn_printdots "Attempting graceful shutdown: ${counter}"
- fi
- done
- pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
- fn_printok "Attempting graceful shutdown"
- else
- fn_printfail "Attempting graceful shutdown"
- fi
- fi
-
- tmux kill-session -t "${servicename}" > /dev/null 2>&1
- fn_printok "${servername}"
- fn_scriptlog "Stopped ${servername}"
- fi
-fi
- # Remove lock file
- rm -f "${rootdir}/${lockselfname}"
- sleep 1
- echo -en "\n"
-}
-
-if [ "${gamename}" == "Teamspeak 3" ]; then
- fn_stop_teamspeak3
-else
- fn_stop_tmux
-fi
\ No newline at end of file
diff --git a/functions/command_ts3_server_pass.sh b/functions/command_ts3_server_pass.sh
deleted file mode 100644
index a1f1fce0a..000000000
--- a/functions/command_ts3_server_pass.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-# LGSM command_serveradmin_password.sh function
-# Author: Daniel Gibbs
-# Contributor : UltimateByte
-# Website: http://gameservermanagers.com
-lgsm_version="080116"
-
-# Description: Changes TS3 serveradmin password
-
-local modulename="Change password"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-
-fn_serveradmin_password_prompt(){
-echo ""
-echo "${gamename} ServerAdmin Password Change"
-echo "============================"
-echo ""
-echo "Press \"CTRL+b d\" to exit console."
-fn_printinfomationnl "You are about to change the ${gamename} ServerAdmin password."
-fn_printwarningnl "${gamename} will restart during this process."
-echo ""
-while true; do
- read -e -i "y" -p "Continue? [y/N]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
-esac
-done
-fn_scriptlog "Initiating ${gamename} ServerAdmin password change"
-read -p "Enter new password : " newpassword
-}
-
-
-fn_serveradmin_password_set(){
-fn_printinfonl "Applying new password"
-fn_scriptlog "Applying new password"
-sleep 1
-# Stop any running server
-command_stop.sh
-# Start server in "new password mode"
-ts3serverpass="1"
-fn_printinfonl "Starting server with new password"
-command_start.sh
-# Stop server in "new password mode"
-command_stop.sh
-ts3serverpass="0"
-fn_printoknl "Password applied"
-fn_scriptlog "New ServerAdmin password applied"
-sleep 1
-}
-
-# Running functions
-check.sh
-fn_serveradmin_password_prompt
-info_ts3status.sh
-if [ "${ts3status}" == "Server is running" ]; then
- fn_serveradmin_password_set
- command_start.sh
-else
- fn_serveradmin_password_set
-fi
diff --git a/functions/command_update_functions.sh b/functions/command_update_functions.sh
new file mode 100644
index 000000000..ba7674448
--- /dev/null
+++ b/functions/command_update_functions.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# LGSM command_update_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
+
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+check.sh
+fn_print_dots "Updating functions"
+fn_scriptlog "Updating functions"
+sleep 1
+echo -ne "\n"
+
+# Removed legecy functions dir
+if [ -n "${rootdir}" ]; then
+ if [ -d "${rootdir}/functions/" ]; then
+ rm -rfv "${rootdir}/functions/"
+ exitcode=$?
+ fi
+fi
+
+if [ -n "${functionsdir}" ]; then
+ if [ -d "${functionsdir}" ]; then
+ rm -rfv "${functionsdir}/"*
+ exitcode=$?
+ fi
+fi
+
+if [ "${exitcode}" == "0" ]; then
+ fn_print_ok "Updating functions"
+ fn_scriptlog "Success! Updating functions"
+else
+ fn_print_fail "Updating functions"
+ fn_scriptlog "Failure! Updating functions"
+fi
+echo -ne "\n"
\ No newline at end of file
diff --git a/functions/command_validate.sh b/functions/command_validate.sh
deleted file mode 100644
index b6dc36819..000000000
--- a/functions/command_validate.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-# LGSM command_validate.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Runs a server validation.
-
-local modulename="Validate"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-fn_validation(){
-fn_printwarn "Validating may overwrite some customised files."
-sleep 1
-echo -en "\n"
-echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
-sleep 5
-echo -en "\n"
-fn_printdots "Checking server files"
-sleep 1
-fn_printok "Checking server files"
-fn_scriptlog "Checking server files"
-sleep 1
-
-cd "${rootdir}/steamcmd"
-
-if [ $(command -v unbuffer) ]; then
- unbuffer=unbuffer
-fi
-
-if [ "${engine}" == "goldsource" ]; then
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
-else
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
-fi
-
-fix.sh
-fn_scriptlog "Checking complete"
-}
-
-check.sh
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- fn_validation
- command_start.sh
-else
- fn_validation
-fi
diff --git a/functions/core_functions.sh b/functions/core_functions.sh
index a17a1b898..821cd4563 100644
--- a/functions/core_functions.sh
+++ b/functions/core_functions.sh
@@ -1,407 +1,63 @@
#!/bin/bash
# LGSM core_functions.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
-
-# 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_email_test.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
-}
-
-command_fastdl.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-command_ts3_server_pass.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_config.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-check_deps.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
-
-command_dev_debug.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-command_dev_detect_deps.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-
-# Fix
-
-fix.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_arma3.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_csgo.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_dst.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_ins.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_steamcmd.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_glibc.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_ro.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_kf.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-fix_ut2k4.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
-}
-
-# 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
-}
-
-install_gsquery.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_gslt.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_header.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_logs.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_retry.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_ts3.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_ts3db.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_ut2k4.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_dl_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
-}
-
-fix_ut99.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-# Calls on-screen messages
-core_messages.sh
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: REDIRECT FUNCTION to new location for core_functions.sh
+
+# fn_fetch_core_dl also placed here to allow legecy servers to still download core functions
+if [ -z "${lgsmdir}" ]; then
+ lgsmdir="${rootdir}/lgsm"
+ functionsdir="${lgsmdir}/functions"
+ libdir="${lgsmdir}/lib"
+fi
+
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+ if [ ! -d "${filedir}" ]; then
+ mkdir -p "${filedir}"
+ fi
+ echo -e " fetching ${filename}...\c"
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "Curl is not installed!"
+ echo -e ""
+ exit 1
+ fi
+ chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+core_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh
\ No newline at end of file
diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh
index c9c875656..f6032fae6 100644
--- a/functions/core_getopt.sh
+++ b/functions/core_getopt.sh
@@ -1,432 +1,14 @@
#!/bin/bash
# LGSM core_getopt.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="070116"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
-# Description: getopt arguments.
+# Description: REDIRECT FUNCTION to new location for core_getopt.sh
-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)
- command_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)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- command_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
+core_getopt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
}
-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)
- command_email_test.sh;;
- d|details)
- command_details.sh;;
- b|backup)
- command_backup.sh;;
- pw|change-password)
- command_ts3_server_pass.sh;;
- dev|dev-debug)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- command_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[34mchange-password\t\e[0mChanges TS3 serveradmin password."
- 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)
- command_email_test.sh;;
- b|backup)
- command_backup.sh;;
- dev|dev-debug)
- command_dev_debug.sh;;
- console)
- command_console.sh;;
- d|debug)
- command_debug.sh;;
- dd|depsdetect)
- command_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)
- command_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)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- command_dev_detect_deps.sh;;
- fd|fastdl)
- command_fastdl.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[34mfastdl\t\e[0mGenerates or update a FastDL folder for your server."
- } | 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)
- command_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)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- mc|map-compressor)
- compress_ut99_maps.sh;;
- dd|depsdetect)
- command_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)
- command_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)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- command_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)
- command_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)
- command_dev_debug.sh;;
- i|install)
- command_install.sh;;
- mc|map-compressor)
- compress_unreal2_maps.sh;;
- dd|depsdetect)
- command_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 [ "${gamename}" == "Garry's Mod" ]; then
- fn_getopt_gmodserver
-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
+core_getopt.sh
\ No newline at end of file
diff --git a/functions/core_messages.sh b/functions/core_messages.sh
deleted file mode 100644
index 939e73889..000000000
--- a/functions/core_messages.sh
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/bin/bash
-# LGSM fn_messages function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Defines on-screen messages such as [ OK ] and how script logs look.
-
-# Date and servicename for log files.
-fn_scriptlog(){
- if [ -n "${modulename}" ]; then
- echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}"
- else
- echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}"
- fi
-}
-
-# [ FAIL ]
-fn_printfail(){
- if [ -n "${modulename}" ]; then
- echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@"
- fi
-}
-
-fn_printfailnl(){
- if [ -n "${modulename}" ]; then
- echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -e "\r\033[K[\e[0;31m FAIL \e[0m] $@"
- fi
-}
-
-# [ OK ]
-fn_printok(){
- if [ -n "${modulename}" ]; then
- echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -en "\r\033[K[\e[0;32m OK \e[0m] $@"
- fi
-}
-
-fn_printoknl(){
- if [ -n "${modulename}" ]; then
- echo -e "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -e "\r\033[K[\e[0;32m OK \e[0m] $@"
- fi
-}
-
-# [ INFO ]
-fn_printinfo(){
- if [ -n "${modulename}" ]; then
- echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@"
- fi
-}
-
-fn_printinfonl(){
- if [ -n "${modulename}" ]; then
- echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -e "\r\033[K[\e[0;36m INFO \e[0m] $@"
- fi
-}
-
-# [ WARN ]
-fn_printwarn(){
- if [ -n "${modulename}" ]; then
- echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@"
- fi
-}
-
-fn_printwarnnl(){
- if [ -n "${modulename}" ]; then
- echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
- else
- echo -e "\r\033[K[\e[1;33m WARN \e[0m] $@"
- fi
-}
-
-# [ .... ]
-fn_printdots(){
- if [ -n "${modulename}" ]; then
- echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@"
- else
- echo -en "\r\033[K[ .... ] $@"
- fi
-}
-
-# Complete!
-fn_printcomplete(){
- echo -en "\e[0;32mComplete!\e[0m $@"
-}
-
-fn_printcompletenl(){
- echo -e "\e[0;32mComplete!\e[0m $@"
-}
-
-# Warning!
-fn_printwarning(){
- echo -en "\e[0;33mWarning!\e[0m $@"
-}
-
-fn_printwarningnl(){
- echo -e "\e[0;33mWarning!\e[0m $@"
-}
-
-# Failure!
-fn_printfailure(){
- echo -en "\e[0;31mFailure!\e[0m $@"
-}
-
-fn_printfailurenl(){
- echo -e "\e[0;31mFailure!\e[0m $@"
-}
-
-# Error!
-fn_printerror(){
- echo -en "\e[0;31mError!\e[0m $@"
-}
-
-fn_printerrornl(){
- echo -e "\e[0;31mError!\e[0m $@"
-}
-
-# Info!
-fn_printinfomation(){
- echo -en "\e[0;36mInfo!\e[0m $@"
-}
-
-fn_printinfomationnl(){
- echo -e "\e[0;36mInfo!\e[0m $@"
-}
-
-# FAIL for end of line
-fn_printokeol(){
- echo -e "\e[0;32mOK\e[0m"
-}
-
-# FAIL for end of line
-fn_printfaileol(){
- echo -e "\e[0;31mFAIL\e[0m\n"
-}
\ No newline at end of file
diff --git a/functions/email.sh b/functions/email.sh
deleted file mode 100644
index 361c9d8bf..000000000
--- a/functions/email.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-# LGSM email.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="020216"
-
-# Description: Sends email notification if monitor picks up a failure.
-
-local modulename="Email"
-fn_printdots "Sending notification to ${email}"
-info_distro.sh
-info_config.sh
-check_ip.sh
-fn_parms
-{
- echo -e "========================================\n${servicename} details\n========================================"
- echo -e "Service name: ${servicename}"
- echo -e "Server name: ${servername}"
- echo -e "Game name: ${gamename}"
- echo -e "Server IP: ${ip}:${port}"
- echo -e "Failure reason: ${failurereason}"
- echo -e "Action Taken: ${actiontaken}\n"
- echo -e ""
- echo -e "========================================\nDistro Details\n========================================"
- echo -e "Date: $(date)"
- echo -e "Distro: ${os}"
- echo -e "Arch: ${arch}"
- echo -e "Kernel: ${kernel}"
- echo -e "Hostname: $HOSTNAME"
- echo -e "tmux: ${tmuxv}"
- echo -e "GLIBC: ${glibcv}"
- echo -e ""
- echo -e "========================================\nPerformance\n========================================"
- echo -e "Uptime: ${days}d, ${hours}h, ${minutes}m"
- echo -e "Avg Load: ${load}"
- echo -e ""
- echo -e "Mem: total used free"
- echo -e "Physical: ${physmemtotal} ${physmemused} ${physmemfree}"
- echo -e "Swap: ${swaptotal}${swapused} ${swapfree}"
- echo -e ""
- echo -e "========================================\nStorage\n========================================"
- echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
- echo -e "\e[34mTotal:\t\e[0m${totalspace}"
- echo -e "\e[34mUsed:\t\e[0m${usedspace}"
- echo -e "\e[34mAvailable:\t\e[0m${availspace}"
- echo -e "\e[34mServerfiles:\t\e[0m${filesdirdu}"
- if [ -d "${backupdir}" ]; then
- echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
- fi
- echo -e ""
- echo -e "========================================\nLogs\n========================================"
-}| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee "${scriptlogdir}/${servicename}-email.log" > /dev/null 2>&1
-echo -e "\n\n Script log\n===================" >> "${emaillog}"
-tail -25 "${scriptlog}" >> "${emaillog}"
-if [ ! -z "${consolelog}" ]; then
- echo -e "\n\n Console log\n====================" >> "${emaillog}"
- tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }' >> "${emaillog}"
-fi
-if [ ! -z "${gamelogdir}" ]; then
- echo -e "\n\n Server log\n====================" >> "${emaillog}"
- tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}"
-fi
-mail -s "${subject}" ${email} < "${emaillog}"
-fn_printok "Sending notification to ${email}"
-fn_scriptlog "Sent notification to ${email}"
-sleep 1
-echo -en "\n"
diff --git a/functions/fix_arma3.sh b/functions/fix_arma3.sh
deleted file mode 100644
index b0a1317de..000000000
--- a/functions/fix_arma3.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# LGSM fix_arma3.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="301215"
-
-# Fixes line 63: 20150 Segmentation fault (core dumped) #488
-
-fn_msg_start(){
- fn_printdots "Applying ${fixname} fix: ${gamename}"
- sleep 1
- fn_printinfo "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Applying ${fixname} fix: ${gamename}"
- sleep 1
-}
-
-fn_msg_end(){
- if [ $? -ne 0 ]; then
- fn_printfailnl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
- else
- fn_printoknl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
- fi
-}
-
-# Fixes: server not always creating steam_appid.txt file.
-if [ ! -d "${rootdir}/.local/share/Arma\ 3" ]; then
- local fixname="20150 Segmentation fault (core dumped)"
- fn_msg_start
- mkdir -p "${rootdir}/.local/share/Arma\ 3"
- fn_msg_end
-fi
\ No newline at end of file
diff --git a/functions/fix_dst.sh b/functions/fix_dst.sh
deleted file mode 100644
index 7a0028504..000000000
--- a/functions/fix_dst.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# LGSM fix_dst.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="020116"
-
-# Fixes line 63: 20150 Segmentation fault (core dumped) #488
-
-fn_msg_start(){
- fn_printdots "Applying ${fixname} fix: ${gamename}"
- sleep 1
- fn_printinfo "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Applying ${fixname} fix: ${gamename}"
- sleep 1
-}
-
-fn_msg_end(){
- if [ $? -ne 0 ]; then
- fn_printfailnl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
- else
- fn_printoknl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
- fi
-}
-
-# Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
-# Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
-if [ -f "/etc/redhat-release" ] && [ ! -f "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ]; then
- local fixname="libcurl-gnutls.so.4 missing"
- fn_msg_start
- ln -s "/usr/lib/libcurl.so.4" "${filesdir}/bin/lib32/libcurl-gnutls.so.4"
- fn_msg_end
-fi
\ No newline at end of file
diff --git a/functions/fix_glibc.sh b/functions/fix_glibc.sh
deleted file mode 100644
index 0270788ab..000000000
--- a/functions/fix_glibc.sh
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-# LGSM fix_glibc.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="020116"
-
-fn_glibcfixmsg(){
-echo ""
-echo "GLIBC Fix required"
-echo "============================"
-sleep 1
-fn_printwarningnl "${gamename} requires GLIBC_${glibcversion} or above"
-sleep 1
-echo ""
-echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m"
-echo -e "Required: =>\e[0;32m GLIBC_${glibcversion}\e[0;39m"
-echo ""
-sleep 1
-echo "The installer will now detect and download the required files to allow ${gamename} server to run on a distro with less than GLIBC_${glibcversion}."
-echo "note: This will NOT upgrade GLIBC on your system."
-echo ""
-echo "http://gameservermanagers.com/glibcfix"
-sleep 1
-echo ""
-echo -en "loading required files.\r"
-sleep 1
-echo -en "loading required files..\r"
-sleep 1
-echo -en "loading required files...\r"
-sleep 1
-echo -en "\n"
-}
-
-# if ldd command not detected
-if [ -z $(command -v ldd) ]; then
- echo ""
- fn_printfailurenl "GLIBC is not detected"
- sleep 1
- echo "Install GLIBC and retry installation."
- sleep 1
- echo ""
- while true; do
- read -e -i "y" -p "Continue install? [Y/n]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
- esac
- done
-# if Glibc less than 1.15
-elif [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt 215 ]; then
- # Blade Symphony
- if [ "${gamename}" == "Blade Symphony" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # Dont Starve Together
- elif [ "${gamename}" == "Don't Starve Together" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}/bin/lib32/"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/DontStarveTogether/dependencies/libc.so.6
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/DontStarveTogether/dependencies/libpthread.so.0
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/DontStarveTogether/dependencies/librt.so.1
- # Double Action: Boogaloo
- elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/blob/master/DoubleActionBoogaloo/dependencies/libm.so.6
- # Fistful of Frags
- elif [ "${gamename}" == "Fistful of Frags" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/FistfulOfFrags/dependencies/libm.so.6
- # Garry's Mod
- elif [ "${gamename}" == "Garry's Mod" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}/bin"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/GarrysMod/dependencies/libc.so.6
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/GarrysMod/dependencies/libm.so.6
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/GarrysMod/dependencies/libpthread.so.0
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # Insurgency
- elif [ "${gamename}" == "Insurgency" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}/bin"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/libc.so.6
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/libm.so.6
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/librt.so.1
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/libpthread.so.0
- elif [ "${gamename}" == "Left 4 Dead" ]; then
- glibcversion="2.07"
- fn_glibcfixmsg
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/bin/libstdc++.so.6"
- # Natural Selection 2
- elif [ "${gamename}" == "Natural Selection 2" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/NaturalSelection2/dependencies/libm.so.6
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # NS2: Combat
- elif [ "${gamename}" == "NS2: Combat" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/NS2Combat/dependencies/libm.so.6
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # No More Room in Hell
- elif [ "${gamename}" == "No More Room in Hell" ]; then
- glibcversion="2.15"
- fn_glibcfixmsg
- cd "${filesdir}"
- wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/NoMoreRoomInHell/dependencies/libm.so.6
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # if Glibc less than 1.13
- elif [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt 213 ]; then
- # ARMA 3
- if [ "${gamename}" == "ARMA 3" ]; then
- glibcversion="2.13"
- fn_glibcfixmsg
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # Just Cause 2
- elif [ "${gamename}" == "Just Cause 2" ]; then
- glibcversion="2.13"
- fn_glibcfixmsg
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
- # Serious Sam 3: BFE
- elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
- glibcversion="2.13"
- fn_glibcfixmsg
- cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/Bin/libstdc++.so.6"
- else
- : # Else glibcfix not required.
- fi
- else
- : #Else glibcfix not required.
- fi
-fi
-sleep 1
diff --git a/functions/fn_functions b/functions/fn_functions
index f6ea53f55..2ae012923 100644
--- a/functions/fn_functions
+++ b/functions/fn_functions
@@ -1,10 +1,10 @@
#!/bin/bash
-# LGSM core_functions.sh function
+# LGSM fn_functions function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
-# Description: Redirect to new core_functions.sh
+# Description: REDIRECT FUNCTION to new core_functions.sh
core_functions.sh(){
# Functions are defined in core_functions.sh.
@@ -12,9 +12,4 @@ functionfile="${FUNCNAME}"
fn_runfunction
}
-core_getopt.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
core_functions.sh
\ No newline at end of file
diff --git a/functions/fn_getopt b/functions/fn_getopt
index 8b52e1865..0b0e3713d 100644
--- a/functions/fn_getopt
+++ b/functions/fn_getopt
@@ -1,15 +1,14 @@
#!/bin/bash
-# LGSM core_getopt.sh function
+# LGSM fn_getopt.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
-# Description: Redirect to new core_getopt.sh
+# Description: REDIRECT FUNCTION to new core_getopt.sh
core_getopt.sh(){
-# Functions are defined in core_functions.sh.
functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
}
core_getopt.sh
\ No newline at end of file
diff --git a/functions/fn_update_functions b/functions/fn_update_functions
index 2de9afd6d..5513d5d20 100644
--- a/functions/fn_update_functions
+++ b/functions/fn_update_functions
@@ -1,22 +1,15 @@
#!/bin/bash
-# LGSM update_functions.sh function
+# LGSM fn_update_functions function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="230116"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
-# Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub.
+# Description: REDIRECT FUNCTION to new command_update_functions.sh
+
+command_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+command_update_functions.sh
-fn_printdots "Updating functions"
-fn_scriptlog "Updating functions"
-sleep 1
-echo -ne "\n"
-rm -rfv "${rootdir}/functions/"*
-exitcode=$?
-if [ "${exitcode}" == "0" ]; then
- fn_printok "Updating functions"
- fn_scriptlog "Success! Updating functions"
-else
- fn_printfail "Updating functions"
- fn_scriptlog "Failure! Updating functions"
-fi
-echo -ne "\n"
\ No newline at end of file
diff --git a/functions/info_config.sh b/functions/info_config.sh
deleted file mode 100644
index 7737cac80..000000000
--- a/functions/info_config.sh
+++ /dev/null
@@ -1,868 +0,0 @@
-#!/bin/bash
-# LGSM info_config.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
-
-# Description: Gets specific details from config files.
-
-## Examples of filtering to get info from config files
-# sed 's/foo//g' - remove foo
-# tr -cd '[:digit:]' leave only digits
-# tr -d '=\"; ' remove selected charectors =\";
-# grep -v "foo" filter out lines that contain foo
-
-## Just Cause 2
-if [ "${engine}" == "avalanche" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "Name" "${servercfgfullpath}" | sed 's/Name//g' | tr -d '=", \n')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # ip
- if [ -f "${servercfgfullpath}" ]; then
- # check if the ip exists in the config file. Failing this will fall back to the default.
- configipcheck=$(grep "BindIP" "${servercfgfullpath}" | sed 's/BindIP//g' | tr -d '=", \n')
- fi
- if [ -n "${configipcheck}" ]; then
- ip=$(grep "BindIP" "${servercfgfullpath}" | sed 's/BindIP//g' | tr -d '=", \n')
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "Password" "${servercfgfullpath}" | sed 's/Password//g' | tr -d '=", \n')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "MaxPlayers" "${servercfgfullpath}" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "BindPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
-## Dont Starve Together
-elif [ "${engine}" == "dontstarve" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "default_server_name = " "${servercfgfullpath}" | sed 's/default_server_name = //g')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "server_password = " "${servercfgfullpath}" | grep -v "#" | sed 's/server_password = //g')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # game mode
- if [ -f "${servercfgfullpath}" ]; then
- gamemode=$(grep "game_mode = " "${servercfgfullpath}" | grep -v "#" | sed 's/game_mode = //g')
- if [ ! -n "${gamemode}" ]; then
- gamemode="NOT SET"
- fi
- else
- gamemode="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # tickrate
- if [ -f "${servercfgfullpath}" ]; then
- tickrate=$(grep "tick_rate" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${tickrate}" ]; then
- tickrate="NOT SET"
- fi
- else
- tickrate="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
-## Project Zomboid
-elif [ "${engine}" == "projectzomboid" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "PublicName=" "${servercfgfullpath}" | sed 's/PublicName=//g' | tr -d '=", \n')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "MaxPlayers=" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "DefaultPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
-
-# Quake Live
-elif [ "${engine}" == "idtech3" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "set sv_hostname " "${servercfgfullpath}" | sed 's/set sv_hostname //g' | tr -d '=\"; ')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
-
- serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/set g_password//g' | tr -d '=\"; '| cut -f1 -d "/")
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # rcon password
- rconpassword="${rconpassword}"
- if [ -f "${servercfgfullpath}" ]; then
- if [ ! -n "${rconpassword}" ]; then
- rconpassword="NOT SET"
- fi
- else
- rconpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "set sv_maxClients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- port="${gameport}"
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # rcon port
- if [ ! -n "${rconport}" ]; then
- rconport="0"
- fi
-
- # Stats port
- if [ ! -n "${statsport}" ]; then
- statsport="0"
- fi
-
-# ARMA 3
-elif [ "${engine}" == "realvirtuality" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "hostname" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\//g' | tr -d '=\"; ')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # admin password
- if [ -f "${servercfgfullpath}" ]; then
- adminpassword=$(grep "passwordAdmin" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\passwordAdmin//g' | tr -d '=\"; ')
- if [ ! -n "${adminpassword}" ]; then
- adminpassword="NOT SET"
- fi
- else
- adminpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "password =" "${servercfgfullpath}" | grep -v "//" | sed -e 's/\password//g' | tr -d '=\"; ')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "maxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ "${port}" != "" ]; then
- port=${port}
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # query port
- if [ "${port}" != "" ]; then
- queryport=$((port+1))
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
- # master port
- if [ "${port}" != "" ]; then
- masterport=$((port+2))
- fi
- if [ ! -n "${masterport}" ]; then
- masterport="0"
- fi
-
-# Serious Sam
-elif [ "${engine}" == "seriousengine35" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}" | sed 's/prj_strMultiplayerSessionName = //g' | tr -d '=\"; ')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # rcon password
- if [ -f "${servercfgfullpath}" ]; then
- rconpassword=$(grep "rcts_strAdminPassword" "${servercfgfullpath}" | sed 's/rcts_strAdminPassword = //g' | tr -d '=\"; ')
- if [ ! -n "${rconpassword}" ]; then
- rconpassword="NOT SET"
- fi
- else
- rconpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # game mode
- if [ -f "${servercfgfullpath}" ]; then
- gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}" | grep -v "#" | sed 's/gam_idGameMode//g' | tr -d '=\"; ')
- if [ ! -n "${gamemode}" ]; then
- gamemode="NOT SET"
- fi
- else
- gamemode="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "prj_uwPort" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$((${port} + 1))
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
-# Source Engine Games
-elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "hostname" "${servercfgfullpath}" | sed 's/hostname //g' | sed 's/"//g')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "sv_password" "${servercfgfullpath}" | sed 's/sv_password //g' | sed 's/"//g')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # rcon password
- if [ -f "${servercfgfullpath}" ]; then
- rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed 's/rcon_password //g' | sed 's/"//g')
- if [ ! -n "${rconpassword}" ]; then
- rconpassword="NOT SET"
- fi
- else
- rconpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
-# Spark (NS2: Combat)
-elif [ "${engine}" == "spark" ]; then
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$((port + 1))
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
-# Teamspeak 3
-elif [ "${gamename}" == "Teamspeak 3" ]; then
-
- # ip
- if [ -f "${servercfgfullpath}" ]; then
- # check if the ip exists in the config file. Failing this will fall back to the default.
- configipcheck=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/\voice_ip=//g')
- fi
- if [ -n "${configipcheck}" ]; then
- ip=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/\voice_ip=//g')
- fi
-
- # dbplugin
- if [ -f "${servercfgfullpath}" ]; then
- dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed 's/\dbplugin=//g')
- if [ ! -n "${dbplugin}" ]; then
- dbplugin="NOT SET"
- fi
- else
- dbplugin="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "default_voice_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="9987"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$(grep "query_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="10011"
- fi
-
- # file port
- if [ -f "${servercfgfullpath}" ]; then
- fileport=$(grep "filetransfer_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${fileport}" ]; then
- fileport="30033"
- fi
-
-# Teeworlds
-elif [ "${engine}" == "teeworlds" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "sv_name" "${servercfgfullpath}" | sed 's/sv_name //g' | sed 's/"//g')
- if [ ! -n "${servername}" ]; then
- servername="unnamed server"
- fi
- else
- servername="unnamed server"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "password " "${servercfgfullpath}" | awk '!/sv_rcon_password/'| sed 's/password //g' | tr -d '=\"; ')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # rcon password
- if [ -f "${servercfgfullpath}" ]; then
- rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed 's/sv_rcon_password //g' | tr -d '=\"; ')
- if [ ! -n "${rconpassword}" ]; then
- rconpassword="NOT SET"
- fi
- else
- rconpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="8303"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "sv_max_clients" "${servercfgfullpath}" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="12"
- fi
- else
- slots="12"
- fi
-
-# Terraria
-elif [ "${engine}" == "terraria" ]; then
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
-# 7 Day To Die (unity3d)
-elif [ "${gamename}" == "7 Days To Die" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin enabled
- if [ -f "${servercfgfullpath}" ]; then
- webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${webadminenabled}" ]; then
- webadminenabled="NOT SET"
- fi
- else
- webadminenabled="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin port
- if [ -f "${servercfgfullpath}" ]; then
- webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${webadminport}" ]; then
- webadminport="0"
- fi
-
- # webadmin enabled
- if [ -f "${servercfgfullpath}" ]; then
- webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${webadminenabled}" ]; then
- webadminenabled="NOT SET"
- fi
- else
- webadminenabled="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin password
- if [ -f "${servercfgfullpath}" ]; then
- webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${webadminpass}" ]; then
- webadminpass="NOT SET"
- fi
- else
- webadminpass="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # telnet enabled
- if [ -f "${servercfgfullpath}" ]; then
- telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${telnetenabled}" ]; then
- telnetenabled="NOT SET"
- fi
- else
- telnetenabled="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # telnet port
- if [ -f "${servercfgfullpath}" ]; then
- telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${telnetport}" ]; then
- telnetport="0"
- fi
-
- # telnet password
- if [ -f "${servercfgfullpath}" ]; then
- telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${telnetpass}" ]; then
- telnetpass="NOT SET"
- fi
- else
- telnetpass="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # game mode
- if [ -f "${servercfgfullpath}" ]; then
- gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${gamemode}" ]; then
- gamemode="NOT SET"
- fi
- else
- gamemode="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # game world
- if [ -f "${servercfgfullpath}" ]; then
- gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
- if [ ! -n "${gameworld}" ]; then
- gameworld="NOT SET"
- fi
- else
- gameworld="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$((port + 1))
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
-# Hurtworld (unity3d)
-elif [ "${gamename}" == "Hurtworld" ]; then
-
- # server name
- if [ -n "${servername}" ]; then
- servername="${servername}"
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- # not available yet
-
- # slots
- if [ -n "${maxplayers}" ]; then
- slots="${maxplayers}"
- else
- slots="NOT SET"
- fi
-
- # game world
- if [ -n "${map}" ]; then
- gameworld="${map}"
- else
- gameworld="NO MAP SET"
- fi
-
- # port
- if [ -n "${port}" ]; then
- port="${port}"
- else
- port="0"
- fi
-
- # query port
- if [ -n "${queryport}" ]; then
- queryport="${queryport}"
- else
- queryport="0"
- fi
-
-# Unreal Tournament
-elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "ServerName=" "${servercfgfullpath}" | sed 's/ServerName=//g')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "GamePassword=" "${servercfgfullpath}" | sed 's/GamePassword=//g')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # admin password
- if [ -f "${servercfgfullpath}" ]; then
- adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/AdminPassword=//g')
- if [ ! -n "${adminpassword}" ]; then
- adminpassword="NOT SET"
- fi
- else
- adminpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "Port=" "${servercfgfullpath}" | grep -v "Master" | grep -v "LAN" | grep -v "Proxy" | grep -v "Listen" | tr -d '\r' | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$((port + 1))
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
- # gamespy query port
- if [ -f "${servercfgfullpath}" ]; then
- gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
- fi
- if [ ! -n "${gsqueryport}" ]; then
- gsqueryport="0"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- udplinkport=$((port + 2))
- fi
- if [ ! -n "${udplinkport}" ]; then
- udplinkport="0"
- fi
-
- # webadmin enabled
- if [ -f "${servercfgfullpath}" ]; then
- webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}" | sed 's/bEnabled=//g' | tr -d '\r')
- if [ ! -n "${webadminenabled}" ]; then
- webadminenabled="NOT SET"
- fi
- else
- webadminenabled="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin port
- if [ -f "${servercfgfullpath}" ]; then
- webadminport=$(grep "ListenPort=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
- fi
- if [ ! -n "${webadminport}" ]; then
- webadminport="0"
- fi
-
- if [ "${engine}" == "unreal" ]; then
-
- # webadmin user
- if [ -f "${servercfgfullpath}" ]; then
- webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}" | sed 's/\AdminUsername=//g')
- if [ ! -n "${webadminuser}" ]; then
- webadminuser="NOT SET"
- fi
- else
- webadminuser="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin password
- if [ -f "${servercfgfullpath}" ]; then
- webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2 | grep "AdminPassword=" | sed 's/\AdminPassword=//g')
- if [ ! -n "${webadminpass}" ]; then
- webadminpass="NOT SET"
- fi
- else
- webadminpass="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- else
-
- # webadmin user
- if [ -f "${servercfgfullpath}" ]; then
- webadminuser=$(grep "AdminName=" "${servercfgfullpath}" | sed 's/\AdminName=//g')
- if [ ! -n "${webadminuser}" ]; then
- webadminuser="NOT SET"
- fi
- else
- webadminuser="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # webadmin password
- if [ -f "${servercfgfullpath}" ]; then
- webadminpass=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/\AdminPassword=//g')
- if [ ! -n "${webadminpass}" ]; then
- webadminpass="NOT SET"
- fi
- else
- webadminpass="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- fi
-
-# ARK: Survivaial Evolved
-elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
-
- # server name
- if [ -f "${servercfgfullpath}" ]; then
- servername=$(grep "SessionName=" "${servercfgfullpath}" | sed 's/SessionName=//g')
- if [ ! -n "${servername}" ]; then
- servername="NOT SET"
- fi
- else
- servername="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # server password
- if [ -f "${servercfgfullpath}" ]; then
- serverpassword=$(grep "ServerPassword=" "${servercfgfullpath}" | sed 's/ServerPassword=//g')
- if [ ! -n "${serverpassword}" ]; then
- serverpassword="NOT SET"
- fi
- else
- serverpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # admin password
- if [ -f "${servercfgfullpath}" ]; then
- adminpassword=$(grep "ServerAdminPassword=" "${servercfgfullpath}" | sed 's/ServerAdminPassword=//g')
- if [ ! -n "${adminpassword}" ]; then
- adminpassword="NOT SET"
- fi
- else
- adminpassword="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # slots
- if [ -f "${servercfgfullpath}" ]; then
- slots=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- if [ ! -n "${slots}" ]; then
- slots="NOT SET"
- fi
- else
- slots="\e[0;31mUNAVAILABLE\e[0m"
- fi
-
- # port
- if [ -f "${servercfgfullpath}" ]; then
- port=$(grep "Port=" "${servercfgfullpath}" | grep -v "RCONPort=" | grep -v "QueryPort=" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${port}" ]; then
- port="0"
- fi
-
- # rcon port
- if [ -f "${servercfgfullpath}" ]; then
- rconport=$(grep "RCONPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${rconport}" ]; then
- rconport="0"
- fi
-
- # query port
- if [ -f "${servercfgfullpath}" ]; then
- queryport=$(grep "QueryPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
- fi
- if [ ! -n "${queryport}" ]; then
- queryport="0"
- fi
-
-fi
diff --git a/functions/info_ts3status.sh b/functions/info_ts3status.sh
deleted file mode 100644
index c08f95f1d..000000000
--- a/functions/info_ts3status.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# LGSM info_ts3status.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Checks the status of Teamspeak 3.
-
-cd "${executabledir}"
-ts3status=$(./ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
diff --git a/functions/install_dl_ut2k4.sh b/functions/install_dl_ut2k4.sh
deleted file mode 100644
index 687867e74..000000000
--- a/functions/install_dl_ut2k4.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-# LGSM install_dl_ut2k4.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Downloading Server Files"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-if [ ! -f dedicatedserver3339-bonuspack.zip ]; then
- wget http://gameservermanagers.com/files/ut2004/dedicatedserver3339-bonuspack.zip
-else
- echo "dedicatedserver3339-bonuspack.zip already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: d3f28c5245c4c02802d48e4f0ffd3e34"
-md5check=$(md5sum dedicatedserver3339-bonuspack.zip|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "d3f28c5245c4c02802d48e4f0ffd3e34" ]; then
- echo "MD5 checksum: FAILED!"
- read -p "Retry download? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; install_dl_ut2k4.sh;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
- esac
-else
- echo "MD5 checksum: PASSED"
-fi
-if [ ! -f ut2004-lnxpatch3369-2.tar.bz2 ]; then
- wget http://gameservermanagers.com/files/ut2004/ut2004-lnxpatch3369-2.tar.bz2
-else
- echo "ut2004-lnxpatch3369-2.tar.bz2 already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 0fa447e05fe5a38e0e32adf171be405e"
-md5check=$(md5sum ut2004-lnxpatch3369-2.tar.bz2|awk '{print $1;}')
-echo "File returned: ${md5check}"
-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; install_dl_ut2k4.sh;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
- esac
-else
- echo "MD5 checksum: PASSED"
-fi
-echo ""
\ No newline at end of file
diff --git a/functions/install_dl_ut99.sh b/functions/install_dl_ut99.sh
deleted file mode 100644
index c053ca18e..000000000
--- a/functions/install_dl_ut99.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-# LGSM install_dl_ut99.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Downloading Server Files"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-if [ ! -f ut-server-436.tar.gz ]; then
- wget http://gameservermanagers.com/files/ut99/ut-server-436.tar.gz
-else
- echo "ut-server-436.tar.gz already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd"
-md5check=$(md5sum ut-server-436.tar.gz|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ]; then
- echo "MD5 checksum: FAILED!"
- read -p "Retry download? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv ut-server-436.tar.gz; fn_filesdl;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
- esac
-else
- echo "MD5 checksum: PASSED"
-fi
-if [ ! -f UTPGPatch451.tar.bz2 ]; then
- wget http://gameservermanagers.com/files/ut99/UTPGPatch451.tar.bz2
-else
- echo "UTPGPatch451.tar.bz2 already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 77a735a78b1eb819042338859900b83b"
-md5check=$(md5sum UTPGPatch451.tar.bz2|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ]; then
- echo "MD5 checksum: FAILED!"
- read -p "Retry download? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv UTPGPatch451.tar.bz2; fn_filesdl;;
- [Nn]* ) echo Exiting; exit;;
- * ) echo "Please answer yes or no.";;
- esac
-else
- echo "MD5 checksum: PASSED"
-fi
-echo ""
\ No newline at end of file
diff --git a/functions/install_gslt.sh b/functions/install_gslt.sh
deleted file mode 100644
index 5919fac33..000000000
--- a/functions/install_gslt.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# LGSM install_gslt.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: Configures GSLT.
-
-if [ -z "${autoinstall}" ]; then
- echo ""
- echo "Game Server Login Token"
- echo "============================"
- sleep 1
- if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
- echo "GSLT is required to run a public ${gamename} server"
- else
- echo "GSLT is an optional feature for ${gamename} server"
- fi
-
- echo "Get more info and a token here:"
- echo "http://gameservermanagers.com/gslt"
- echo ""
- echo "Enter token below (Can be blank)."
- echo -n "GSLT TOKEN: "
- read token
- sed -i -e "s/gslt=\"\"/gslt=\"${token}\"/g" "${rootdir}/${selfname}"
- sleep 1
- echo "The GSLT can be changed by editing ${selfname}."
- echo ""
-else
- if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
- fn_printinfomationnl "GSLT is required to run a public ${gamename} server"
- else
- fn_printinfomationnl "GSLT is an optional feature for ${gamename} server"
- fi
- echo "Get more info and a token here:"
- echo "http://gameservermanagers.com/gslt"
- echo ""
- sleep 1
- echo "The GSLT can be changed by editing ${selfname}."
- sleep 1
-fi
\ No newline at end of file
diff --git a/functions/install_serverfiles.sh b/functions/install_serverfiles.sh
deleted file mode 100644
index 3e4bb9dc8..000000000
--- a/functions/install_serverfiles.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-# LGSM finstall_serverfiles.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-fn_steaminstallcommand(){
-check.sh
-counter="0"
-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
- # Attempt 1-4: Standard attempt
- # Attempt 5-6: Validate attempt
- # Attempt 7-8: Validate, delete long name dir
- # Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
- # Attempt 11: Failure
-
- if [ "${counter}" -ge "2" ]; then
- fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}:"
- fi
-
- if [ "${counter}" -ge "7" ]; then
- echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')"
- find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
- fi
- if [ "${counter}" -ge "9" ]; then
- rm -rf "${rootdir}/steamcmd"
- check_steamcmd.sh
- fi
-
- # Detects if unbuffer command is available.
- if [ $(command -v unbuffer) ]; then
- unbuffer=unbuffer
- fi
-
- 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 .finstall_serverfiles.sh.tmp
- else
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} +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 .finstall_serverfiles.sh.tmp
- else
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} -validate +quit |tee .finstall_serverfiles.sh.tmp
- fi
- fi
- elif [ "${counter}" -ge "11" ]; then
- fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
- break
- fi
-
-done
-
-# Goldsource servers commonly fail to download all the server files required.
-# Validating a few of times may reduce the chance of this issue.
-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 .finstall_serverfiles.sh.tmp
- done
-fi
-rm -f .finstall_serverfiles.sh.tmp
-}
-
-echo ""
-echo "Installing ${gamename} Server"
-echo "================================="
-sleep 1
-mkdir -pv "${filesdir}"
-fn_steaminstallcommand
-if [ -z "${autoinstall}" ]; then
- echo ""
- echo "================================="
- while true; do
- read -e -i "y" -p "Was the install successful? [Y/n]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) install_retry.sh;;
- * ) echo "Please answer yes or no.";;
- esac
- done
-fi
diff --git a/functions/install_ut2k4.sh b/functions/install_ut2k4.sh
deleted file mode 100644
index 44d78b885..000000000
--- a/functions/install_ut2k4.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# LGSM install_ut2k4.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Installing ${gamename} Server"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-echo "Extracting dedicatedserver3339-bonuspack.zip"
-sleep 1
-unzip dedicatedserver3339-bonuspack.zip
-echo "Extracting ut2004-lnxpatch3369-2.tar.bz2"
-sleep 1
-tar -xvjf ut2004-lnxpatch3369-2.tar.bz2 UT2004-Patch/ --strip-components=1
-while true; do
- read -p "Was the install successful? [y/N]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) install_retry.sh;;
- * ) echo "Please answer yes or no.";;
-esac
-done
-while true; do
- read -p "Remove ut2004-lnxpatch3369-2.tar.bz2? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; break;;
- [Nn]* ) break;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-while true; do
- read -p "Remove dedicatedserver3339-bonuspack.zip? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; break;;
- [Nn]* ) break;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-echo ""
\ No newline at end of file
diff --git a/functions/install_ut2k4_key.sh b/functions/install_ut2k4_key.sh
deleted file mode 100644
index b959cf96b..000000000
--- a/functions/install_ut2k4_key.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# LGSM install_ut2k4_key.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Enter ${gamename} CD Key"
-echo "================================="
-sleep 1
-echo "To get your server listed on the Master Server list"
-echo "you must get a free CD key. Get a key here:"
-echo "https://forums.unrealtournament.com/utserver/cdkey.php?2004"
-echo ""
-echo "Once you have the key enter it below"
-echo -n "KEY: "
-read CODE
-echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
-echo ""
diff --git a/functions/install_ut99.sh b/functions/install_ut99.sh
deleted file mode 100644
index 32b49f7a1..000000000
--- a/functions/install_ut99.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# LGSM install_ut99.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Installing ${gamename} Server"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-echo "Extracting ut-server-436.tar.gz"
-sleep 1
-tar -zxvf ut-server-436.tar.gz ut-server/ --strip-components=1
-echo "Extracting UTPGPatch451.tar.bz2"
-sleep 1
-tar -jxvf UTPGPatch451.tar.bz2
-while true; do
- read -p "Was the install successful? [y/N]" yn
- case $yn in
- [Yy]* ) break;;
- [Nn]* ) install_retry.sh;;
- * ) echo "Please answer yes or no.";;
-esac
-done
-while true; do
- read -p "Remove ut-server-436.tar.gz? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv ut-server-436.tar.gz; break;;
- [Nn]* ) break;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-while true; do
- read -p "Remove UTPGPatch451.tar.bz2? [y/N]" yn
- case $yn in
- [Yy]* ) rm -fv UTPGPatch451.tar.bz2; break;;
- [Nn]* ) break;;
- * ) echo "Please answer yes or no.";;
- esac
-done
-echo ""
\ No newline at end of file
diff --git a/functions/monitor_gsquery.sh b/functions/monitor_gsquery.sh
deleted file mode 100644
index 55e2e9fc2..000000000
--- a/functions/monitor_gsquery.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/bin/bash
-# LGSM monitor_gsquery.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-# Description: uses gsquery.py to directly query the server.
-# Detects if the server has frozen.
-
-local modulename="Monitor"
-if [ -f "${rootdir}/gsquery.py" ]; then
- if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
- gameport=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd '[:digit:]')
- port=$((${gameport} + 1))
- elif [ "${engine}" == "spark" ]; then
- port=$((${port} + 1))
- elif [ "${engine}" == "realvirtuality" ]; then
- queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd '[:digit:]')
- port=${queryport}
- elif [ "${gamename}" == "7 Days To Die" ]; then
- gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd '[:digit:]')
- port=$((${gameport} + 1))
- elif [ "${gamename}" == "Hurtworld" ]; then
- gameport="${port}"
- port="${queryport}"
- fi
- fn_printinfo "Detected gsquery.py"
- fn_scriptlog "Detected gsquery.py"
- sleep 1
- fn_printdots "Querying port: ${ip}:${port} : QUERYING"
- fn_scriptlog "Querying port: ${ip}:${port} : QUERYING"
- sleep 1
- serverquery=$("${rootdir}/gsquery.py" -a ${ip} -p ${port} -e ${engine} 2>&1)
- exitcode=$?
- if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then
- fn_printfail "Querying port: ${ip}:${port} : ${serverquery}"
- fn_scriptlog "Querying port: ${ip}:${port} : ${serverquery}"
- sleep 1
- echo -en "\n"
- if [ -z "${secondquery}" ]; then
- if [ "${engine}" == "unreal2" ]; then
- # unreal 2: Map change can take around 60 seconds
- fn_printinfo "Waiting 60 seconds to re-query"
- fn_scriptlog "Waiting 60 seconds to re-query"
- sleep 60
- else
- fn_printinfo "Waiting 30 seconds to re-query"
- fn_scriptlog "Waiting 30 seconds to re-query"
- sleep 30
- fi
- secondquery=1
- monitor_gsquery.sh
- fi
- if [ "${emailnotification}" = "on" ]; then
- info_config.sh
- subject="${servicename} Monitor - Starting ${servername}"
- failurereason="Failed to query ${servicename}: ${serverquery}"
- actiontaken="restarted ${servicename}"
- email.sh
- fi
- fn_restart
- exit 1
- elif [ "${exitcode}" == "0" ]; then
- fn_printok "Querying port: ${ip}:${port} : OK"
- fn_scriptlog "Querying port: ${ip}:${port} : OK"
- sleep 1
- echo -en "\n"
- exit
- elif [ "${exitcode}" == "126" ]; then
- fn_printfail "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied"
- fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied"
- sleep 1
- echo -en "\n"
- echo "Attempting to resolve automatically"
- chmod +x -v "${rootdir}/gsquery.py"
- if [ $? -eq 0 ]; then
- monitor_gsquery.sh
- else
- fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n"
- owner=$(ls -al ${rootdir}/gsquery.py|awk '{ print $3 }')
- echo "As user ${owner} or root run the following command."
- whoami=$(whoami)
- echo -en "\nchown ${whoami}:${whoami} ${rootdir}/gsquery.py\n\n"
- exit 1
- fi
- else
- fn_printfail "Querying port: ${ip}:${port} : UNKNOWN ERROR"
- fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR"
- sleep 1
- echo -en "\n"
- ${rootdir}/gsquery.py -a ${ip} -p ${port} -e ${engine}
- exit 1
- fi
-else
- fn_printfailnl "Could not find ${rootdir}/gsquery.py"
- fn_scriptlog "Could not find ${rootdir}/gsquery.py"
-fi
diff --git a/functions/update_check.sh b/functions/update_check.sh
deleted file mode 100644
index 0e2a3a40d..000000000
--- a/functions/update_check.sh
+++ /dev/null
@@ -1,335 +0,0 @@
-#!/bin/bash
-# LGSM update_check.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="060216"
-
-# Description: Checks if a server update is available.
-
-local modulename="Update"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-### SteamCMD Update Checker ###
-
-fn_appmanifestinfo(){
- appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf")
- appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l)
-}
-
-fn_appmanifestcheck(){
-fn_appmanifestinfo
-# Multiple or no matching appmanifest files may sometimes be available.
-# This is an error is corrected below if required.
-if [ "${appmanifestfilewc}" -ge "2" ]; then
- sleep 1
- fn_printwarn "Multiple appmanifest_${appid}.acf files found"
- fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
- sleep 2
- fn_printdots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
- sleep 1
- for appfile in ${appmanifestfile}; do
- rm "${appfile}"
- done
- appmanifestfilewc1="${appmanifestfilewc}"
- fn_appmanifestinfo
- if [ "${appmanifestfilewc}" -ge "2" ]; then
- fn_printfail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
- fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
- sleep 1
- echo ""
- echo " Check user permissions"
- for appfile in ${appmanifestfile}; do
- echo " ${appfile}"
- done
- exit 1
- else
- sleep 1
- fn_printok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
- fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
- sleep 1
- fn_printinfonl "Forcing update to correct issue"
- fn_scriptlog "Forcing update to correct issue"
- sleep 1
- update_dl.sh
- update_check.sh
- fi
-elif [ "${appmanifestfilewc}" -eq "0" ]; then
- if [ "${forceupdate}" == "1" ]; then
- fn_printfail "Still no appmanifest_${appid}.acf found: Unable to update"
- fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
- exit 1
- fi
- forceupdate=1
- fn_printwarn "No appmanifest_${appid}.acf found"
- fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
- sleep 2
- fn_printinfonl "Forcing update to correct issue"
- fn_scriptlog "Forcing update to correct issue"
- sleep 1
- update_dl.sh
- update_check.sh
-fi
-}
-
-fn_logupdaterequest(){
-# Checks for server update requests from server logs.
-fn_printdots "Checking for update: Server logs"
-fn_scriptlog "Checking for update: Server logs"
-sleep 1
-requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
-if [ "${requestrestart}" -ge "1" ]; then
- fn_printoknl "Checking for update: Server logs: Update requested"
- sleep 1
- echo ""
- echo -ne "Applying update.\r"
- sleep 1
- echo -ne "Applying update..\r"
- sleep 1
- echo -ne "Applying update...\r"
- sleep 1
- echo -ne "\n"
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- unset updateonstart
- if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- update_dl.sh
- command_start.sh
- else
- update_dl.sh
- fi
-else
- fn_printok "Checking for update: Server logs: No update requested"
- sleep 1
-fi
-}
-
-fn_steamcmdcheck(){
-fn_appmanifestcheck
-# Checks for server update from SteamCMD
-fn_printdots "Checking for update: SteamCMD"
-fn_scriptlog "Checking for update: SteamCMD"
-sleep 1
-
-# Gets currentbuild
-currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
-
-# Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD
-
-# Gets availablebuild info
-cd "${rootdir}/steamcmd"
-if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
- rm -f "${HOME}/Steam/appcache/appinfo.vdf"
-fi
-
-# set branch for updateinfo
-IFS=' ' read -a branchsplits <<< "${branch}"
-if [ "${#branchsplits[@]}" -gt 1 ]; then
- branchname="${branchsplits[1]}"
-else
- branchname="public"
-fi
-
-availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"${branchname}\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
-if [ -z "${availablebuild}" ]; then
- fn_printfail "Checking for update: SteamCMD"
- fn_scriptlog "Failure! Checking for update: SteamCMD"
- sleep 1
- fn_printfailnl "Checking for update: SteamCMD: Not returning version info"
- fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
- exit 1
-else
- fn_printok "Checking for update: SteamCMD"
- fn_scriptlog "Success! Checking for update: SteamCMD"
- sleep 1
-fi
-
-if [ "${currentbuild}" != "${availablebuild}" ]; then
- echo -e "\n"
- echo -e "Update available:"
- sleep 1
- echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m"
- echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m"
- echo -e ""
- echo -e " https://steamdb.info/app/${appid}/"
- sleep 1
- echo ""
- echo -en "Applying update.\r"
- sleep 1
- echo -en "Applying update..\r"
- sleep 1
- echo -en "Applying update...\r"
- sleep 1
- echo -en "\n"
- fn_scriptlog "Update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
- fn_scriptlog "${currentbuild} > ${availablebuild}"
-
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- unset updateonstart
- if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- update_dl.sh
- command_start.sh
- else
- update_dl.sh
- fi
-else
- echo -e "\n"
- echo -e "No update available:"
- echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
- echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
- echo -e " https://steamdb.info/app/${appid}/"
- echo -e ""
- fn_printoknl "No update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
-fi
-}
-
-### END SteamCMD Update Checker ###
-
-fn_teamspeak3_check(){
-# Checks for server update from teamspeak.com using a mirror dl.4players.de
-fn_printdots "Checking for update: teamspeak.com"
-fn_scriptlog "Checking for update: teamspeak.com"
-sleep 1
-
-# Gets currentbuild info
-# Checks currentbuild info is available, if fails a server restart will be forced to generate logs
-if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
- fn_printfail "Checking for update: teamspeak.com"
- sleep 1
- fn_printfailnl "Checking for update: teamspeak.com: No logs with server version found"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
- sleep 2
- fn_printinfonl "Checking for update: teamspeak.com: Forcing server restart"
- fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
- sleep 2
- command_stop.sh
- command_start.sh
- sleep 2
- # If still failing will exit
- if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
- fn_printfailnl "Checking for update: teamspeak.com: Still No logs with server version found"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
- exit 1
- fi
-fi
-currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
-
-# Gets the teamspeak server architecture
-info_distro.sh
-if [ "${arch}" == "x86_64" ]; then
- ts3arch="amd64"
-elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
- ts3arch="x86"
-else
- echo ""
- fn_printfailure "${arch} is an unsupported architecture"
- exit 1
-fi
-
-# Gets availablebuild info
-
-# Grabs all version numbers but not in correct order
-wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp
-
-# Sort version numbers
-cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp
-
-# Finds directory with most recent server version.
-while read ts3_version_number; do
- wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
- if [ $? -eq 0 ]; then
- availablebuild="${ts3_version_number}"
- # Break while-loop, if the latest release could be found
- break
- fi
-done < .ts3_version_numbers_sorted.tmp
-
-# Tidy up
-rm -f ".ts3_version_numbers_unsorted.tmp"
-rm -f ".ts3_version_numbers_sorted.tmp"
-
-# Checks availablebuild info is available
-if [ -z "${availablebuild}" ]; then
- fn_printfail "Checking for update: teamspeak.com"
- fn_scriptlog "Checking for update: teamspeak.com"
- sleep 1
- fn_printfail "Checking for update: teamspeak.com: Not returning version info"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
- sleep 2
- exit 1
-else
- fn_printok "Checking for update: teamspeak.com"
- fn_scriptlog "Success! Checking for update: teamspeak.com"
- sleep 1
-fi
-
-# Removes dots so if can compare version numbers
-currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
-availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
-if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
- echo -e "\n"
- echo -e "Update available:"
- sleep 1
- echo -e " Current build: \e[0;31m${currentbuild} ${architecture}\e[0;39m"
- echo -e " Available build: \e[0;32m${availablebuild} ${architecture}\e[0;39m"
- echo -e ""
- sleep 1
- echo ""
- echo -en "Applying update.\r"
- sleep 1
- echo -en "Applying update..\r"
- sleep 1
- echo -en "Applying update...\r"
- sleep 1
- echo -en "\n"
- fn_scriptlog "Update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
- fn_scriptlog "${currentbuild} > ${availablebuild}"
- unset updateonstart
- info_ts3status.sh
- if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
- update_dl.sh
- command_start.sh
- sleep 5
- command_stop.sh
- else
- command_stop.sh
- update_dl.sh
- command_start.sh
- fi
-else
- echo -e "\n"
- echo -e "No update available:"
- echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
- echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
- echo -e ""
- fn_printoknl "No update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
-fi
-}
-
-check.sh
-fn_printdots "Checking for update"
-if [ "${gamename}" == "Teamspeak 3" ]; then
- fn_teamspeak3_check
-elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then
- # Goldsource servers bypass checks as fn_steamcmdcheck does not work for appid 90 servers.
- # forceupdate bypasses checks
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- update_dl.sh
- command_start.sh
- else
- update_dl.sh
- fi
-else
- fn_logupdaterequest
- fn_steamcmdcheck
-fi
diff --git a/functions/update_dl.sh b/functions/update_dl.sh
deleted file mode 100644
index a80caa6d8..000000000
--- a/functions/update_dl.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-# LGSM update_dl.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="020216"
-
-# Description: Runs a server update.
-
-local modulename="Update"
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-fn_steamcmd_dl(){
-cd "${rootdir}"
-cd "steamcmd"
-
-# Detects if unbuffer command is available.
-if [ $(command -v unbuffer) ]; then
- unbuffer=unbuffer
-fi
-
-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 -a "${scriptlog}"
-else
- ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}"
-fi
-
-fix.sh
-}
-
-fn_teamspeak3_dl(){
-cd "${rootdir}"
-echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
-fn_scriptlog "Downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
-wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq
-sleep 1
-echo -e "extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
-fn_scriptlog "Extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
-tar -xf "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" 2> "${scriptlogdir}/.${servicename}-tar-error.tmp"
-local status=$?
-if [ ${status} -eq 0 ]; then
- echo "OK"
-else
- echo "FAIL - Exit status ${status}"
- fn_scriptlog "Failed to extract - Exit status ${status}"
- sleep 1
- cat "${scriptlogdir}/.${servicename}-tar-error.tmp"
- cat "${scriptlogdir}/.${servicename}-tar-error.tmp" >> "${scriptlog}"
- rm "${scriptlogdir}/.${servicename}-tar-error.tmp"
- fn_scriptlog "Failure! Unable to update"
- exit ${status}
-fi
-echo -e "copying to ${filesdir}...\c"
-fn_scriptlog "Copying to ${filesdir}"
-cp -R "${rootdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp"
-local status=$?
-if [ ${status} -eq 0 ]; then
- echo "OK"
-else
- echo "FAIL - Exit status ${status}"
- fn_scriptlog "Failed to copy - Exit status ${status}"
- sleep 1
- cat "${scriptlogdir}/.${servicename}-cp-error.tmp"
- cat "${scriptlogdir}/.${servicename}-cp-error.tmp" >> "${scriptlog}"
- rm "${scriptlogdir}/.${servicename}-cp-error.tmp"
- fn_scriptlog "Failure! Unable to update"
- exit ${status}
-fi
-rm -f teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2
-rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}"
-}
-
-check.sh
-info_config.sh
-fn_printdots "Updating ${servername}"
-sleep 1
-fn_printoknl "Updating ${servername}"
-fn_scriptlog "Updating ${servername}"
-sleep 1
-if [ "${gamename}" == "Teamspeak 3" ]; then
- fn_teamspeak3_dl
-else
- fn_steamcmd_dl
-fi
diff --git a/functions/update_functions.sh b/functions/update_functions.sh
deleted file mode 100644
index 196b90f75..000000000
--- a/functions/update_functions.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# LGSM update_functions.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="230116"
-
-# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
-
-function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-check.sh
-fn_printdots "Updating functions"
-fn_scriptlog "Updating functions"
-sleep 1
-echo -ne "\n"
-rm -rfv "${rootdir}/functions/"*
-exitcode=$?
-if [ "${exitcode}" == "0" ]; then
- fn_printok "Updating functions"
- fn_scriptlog "Success! Updating functions"
-else
- fn_printfail "Updating functions"
- fn_scriptlog "Failure! Updating functions"
-fi
-echo -ne "\n"
\ No newline at end of file
diff --git a/functions/README.md b/lgsm/functions/README.md
similarity index 100%
rename from functions/README.md
rename to lgsm/functions/README.md
diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh
new file mode 100644
index 000000000..60833fd62
--- /dev/null
+++ b/lgsm/functions/alert.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# LGSM alert.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Overall function for managing alerts.
+
+fn_alert_test(){
+ fn_scriptlog "Sending test alert"
+ alertsubject="LGSM - Alert Check - ${servername}"
+ alertbody="LGSM test alert, how you read?"
+}
+
+fn_alert_restart(){
+ fn_scriptlog "Sending restart alert: ${executable} process not running"
+ alertsubject="LGSM - Restarted - ${servername}"
+ alertbody="${servicename} ${executable} process not running"
+}
+
+fn_alert_restart_query(){
+ fn_scriptlog "Sending restart alert: ${gsquerycmd}"
+ alertsubject="LGSM - Restarted - ${servername}"
+ alertbody="Failed to Query: ${gsquerycmd}"
+}
+
+fn_alert_update(){
+ fn_scriptlog "Sending update alert"
+ alertsubject="LGSM - Updated - ${servername}"
+ alertbody="${servicename} Recieved update"
+}
+
+if [ "${alert}" == "restart" ]; then
+ fn_alert_restart
+elif [ "${alert}" == "restartquery" ]; then
+ fn_alert_restart_query
+elif [ "${alert}" == "update" ]; then
+ fn_alert_update
+elif [ "${alert}" == "test" ]; then
+ fn_alert_test
+fi
+
+if [ "${emailnotification}" == "on" ]||[ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then
+ alert_email.sh
+elif [ "${emailnotification}" != "on" ]||[ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+ fn_print_fail_nl "Alerts not enabled"
+ fn_scriptlog "Email alerts not enabled"
+elif [ -z "${email}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+ fn_print_fail_nl "Email no set"
+ fn_scriptlog "Email no set"
+fi
+
+if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then
+ alert_pushbullet.sh
+elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+ fn_print_fail_nl "Pushbullet alerts not enabled"
+ fn_scriptlog "Pushbullet alerts not enabled"
+elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+ fn_print_fail_nl "Pushbullet token not set"
+ fn_scriptlog "Pushbullet token not set"
+fi
\ No newline at end of file
diff --git a/lgsm/functions/alert_email.sh b/lgsm/functions/alert_email.sh
new file mode 100644
index 000000000..c3f56b5ef
--- /dev/null
+++ b/lgsm/functions/alert_email.sh
@@ -0,0 +1,241 @@
+#!/bin/bash
+# LGSM email.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Sends email alert if monitor picks up a failure.
+
+local modulename="Alert"
+
+
+fn_details_email(){
+ #
+ # Failure reason: Testing bb2-server email alert
+ # Action Taken: Sent test email...hello is this thing on?
+
+ echo -e "${alertbody}" >> "${emaillog}"
+}
+
+
+fn_details_os(){
+ #
+ # Distro Details
+ # =====================================
+ # Distro: Ubuntu 14.04.4 LTS
+ # Arch: x86_64
+ # Kernel: 3.13.0-79-generic
+ # Hostname: hostname
+ # tmux: tmux 1.8
+ # GLIBC: 2.19
+
+ {
+ echo -e ""
+ echo -e "Distro Details"
+ echo -e "================================="
+ echo -e "Distro: ${os}"
+ echo -e "Arch: ${arch}"
+ echo -e "Kernel: ${kernel}"
+ echo -e "Hostname: $HOSTNAME"
+ echo -e "tmux: ${tmuxv}"
+ echo -e "GLIBC: ${glibcversion}"
+ } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${emaillog}" > /dev/null 2>&1
+}
+
+fn_details_performance(){
+ #
+ # Performance
+ # =====================================
+ # Uptime: 55d, 3h, 38m
+ # Avg Load: 1.00, 1.01, 0.78
+ #
+ # Mem: total used free
+ # Physical: 741M 656M 85M
+ # Swap: 0B 0B 0B
+
+ {
+ echo -e ""
+ echo -e "Performance"
+ echo -e "================================="
+ echo -e "Uptime: ${days}d, ${hours}h, ${minutes}m"
+ echo -e "Avg Load: ${load}"
+ echo -e ""
+ echo -e "Mem: total used free"
+ echo -e "Physical: ${physmemtotal} ${physmemused} ${physmemfree}"
+ echo -e "Swap: ${swaptotal} ${swapused} ${swapfree}"
+ } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${emaillog}" > /dev/null 2>&1
+}
+
+fn_details_disk(){
+ #
+ # Storage
+ # =====================================
+ # Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff
+ # Total: 15G
+ # Used: 8.4G
+ # Available: 5.7G
+ # Serverfiles: 961M
+
+ {
+ echo -e ""
+ echo -e "Storage"
+ echo -e "================================="
+ echo -e "Filesystem: ${filesystem}"
+ echo -e "Total: ${totalspace}"
+ echo -e "Used: ${usedspace}"
+ echo -e "Available: ${availspace}"
+ echo -e "Serverfiles: ${filesdirdu}"
+ if [ -d "${backupdir}" ]; then
+ echo -e "Backups: ${backupdirdu}"
+ fi
+ } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${emaillog}" > /dev/null 2>&1
+}
+
+
+
+fn_details_gameserver(){
+ #
+ # Quake Live Server Details
+ # =====================================
+ # Server name: ql-server
+ # Server IP: 1.2.3.4:27960
+ # RCON password: CHANGE_ME
+ # Server password: NOT SET
+ # Slots: 16
+ # Status: OFFLINE
+
+ {
+ echo -e ""
+ echo -e "${gamename} Server Details"
+ echo -e "================================="
+ # Server name
+ echo -e "Server name: ${servername}"
+
+ # Server ip
+ echo -e "Server IP: ${ip}:${port}"
+
+ # Server password
+ if [ -n "${serverpassword}" ]; then
+ echo -e "Server password: ********"
+ fi
+
+ # RCON password
+ if [ -n "${rconpassword}" ]; then
+ echo -e "RCON password: ********"
+ fi
+
+ # Admin password
+ if [ -n "${adminpassword}" ]; then
+ echo -e "Admin password: ********"
+ fi
+
+ # Stats password (Quake Live)
+ if [ -n "${statspassword}" ]; then
+ echo -e "Stats password: ********"
+ fi
+
+ # Slots
+ if [ -n "${slots}" ]; then
+ echo -e "Slots: ${slots}"
+ fi
+
+ # Game mode
+ if [ -n "${gamemode}" ]; then
+ echo -e "Game mode: ${gamemode}"
+ fi
+
+ # Game world
+ if [ -n "${gameworld}" ]; then
+ echo -e "Game world: ${gameworld}"
+ fi
+
+ # Tick rate
+ if [ -n "${tickrate}" ]; then
+ echo -e "Tick rate: ${tickrate}"
+ fi
+
+ # Teamspeak dbplugin
+ if [ -n "${dbplugin}" ]; then
+ echo -e "dbplugin: ${dbplugin}"
+ fi
+
+ # Online status
+ if [ "${status}" == "0" ]; then
+ echo -e "Status: OFFLINE"
+ else
+ echo -e "Status: ONLINE"
+ fi
+ } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${emaillog}" > /dev/null 2>&1
+}
+
+fn_alert_email_template_logs(){
+ {
+ echo -e ""
+ echo -e "${servicename} Logs"
+ echo -e "================================="
+
+ if [ -n "${scriptlog}" ]; then
+ echo -e "\nScript log\n==================="
+ if [ ! "$(ls -A ${scriptlogdir})" ]; then
+ echo "${scriptlogdir} (NO LOG FILES)"
+ elif [ ! -s "${scriptlog}" ]; then
+ echo "${scriptlog} (LOG FILE IS EMPTY)"
+ else
+ echo "${scriptlog}"
+ tail -25 "${scriptlog}"
+ fi
+ echo ""
+ fi
+
+ if [ -n "${consolelog}" ]; then
+ echo -e "\nConsole log\n===================="
+ if [ ! "$(ls -A ${consolelogdir})" ]; then
+ echo "${consolelogdir} (NO LOG FILES)"
+ elif [ ! -s "${consolelog}" ]; then
+ echo "${consolelog} (LOG FILE IS EMPTY)"
+ else
+ echo "${consolelog}"
+ tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }'
+ fi
+ echo ""
+ fi
+
+ if [ -n "${gamelogdir}" ]; then
+ echo -e "\nServer log\n==================="
+ if [ ! "$(ls -A ${gamelogdir})" ]; then
+ echo "${gamelogdir} (NO LOG FILES)"
+ else
+ echo "${gamelogdir}"
+ tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25
+ fi
+ echo ""
+ fi
+
+ } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${emaillog}" > /dev/null 2>&1
+}
+
+fn_print_dots "Sending alert to ${email}"
+info_distro.sh
+info_config.sh
+info_glibc.sh
+check_ip.sh
+
+emaillog="${emaillog}"
+if [ -f "${emaillog}" ]; then
+ rm "${emaillog}"
+fi
+fn_details_email
+fn_details_os
+fn_details_performance
+fn_details_disk
+fn_details_gameserver
+fn_alert_email_template_logs
+mail -s "${alertsubject}" "${email}" < "${emaillog}"
+exitcode=$?
+if [ "${exitcode}" == "0" ]; then
+ fn_print_ok_nl "Sending alert to ${email}"
+ fn_scriptlog "Success! Sending alert to ${email}"
+else
+ fn_print_fail_nl "Sending alert to ${email}"
+ fn_scriptlog "Failure! Sending alert to ${email}"
+fi
\ No newline at end of file
diff --git a/lgsm/functions/alert_pushbullet.sh b/lgsm/functions/alert_pushbullet.sh
new file mode 100644
index 000000000..1ab99093b
--- /dev/null
+++ b/lgsm/functions/alert_pushbullet.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# LGSM alert_pushbullet.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: alerts using pushbullet.
+
+local modulename="Alert"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+fn_print_dots "Sending Pushbullet alert"
+sleep 1
+
+pushbulletsend=$(curl --silent -u """${pushbullettoken}"":" -d type="note" -d body="${alertbody}" -d title="${alertsubject}" 'https://api.pushbullet.com/v2/pushes'|grep -o invalid_access_token|uniq)
+
+if [ "${pushbulletsend}" == "invalid_access_token" ]; then
+ fn_print_fail_nl "Sending Pushbullet alert: invalid_access_token"
+ fn_scriptlog "Failure! Sending Pushbullet alert: invalid_access_token"
+else
+ fn_print_ok_nl "Sending Pushbullet alert"
+ fn_scriptlog "Complete! Sent Pushbullet alert"
+fi
\ No newline at end of file
diff --git a/functions/check.sh b/lgsm/functions/check.sh
similarity index 61%
rename from functions/check.sh
rename to lgsm/functions/check.sh
index 1af79f5dd..316e6b3f3 100644
--- a/functions/check.sh
+++ b/lgsm/functions/check.sh
@@ -1,31 +1,31 @@
#!/bin/bash
# LGSM fn_check function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Overall function for managing checks.
# Runs checks that will either halt on or fix an issue.
-array_contains () {
- local seeking=$1; shift
- local in=1
- for element; do
- if [ ${element} == ${seeking} ]; then
- in=0
- break
- fi
- done
- return $in
-}
+# Every command that requires checks just references check.sh
+# check.sh selects which checks to run by using arrays
check_root.sh
+check_permissions.sh
-if [ "${function_selfname}" != "command_install.sh" ] && [ "${function_selfname}" != "update_functions.sh" ]; then
- check_systemdir.sh
+if [ "${function_selfname}" != "command_install.sh" ] && [ "${function_selfname}" != "command_update_functions.sh" ]; then
+ check_system_dir.sh
fi
-local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh update_check.sh command_validate.sh update_functions.sh command_email_test.sh )
+local allowed_commands_array=( command_debug.sh command_start.sh command_install.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+ if [ "${allowed_command}" == "${function_selfname}" ]; then
+ check_glibc.sh
+ fi
+done
+
+local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh update_check.sh command_validate.sh command_update_functions.sh command_email_test.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
@@ -49,13 +49,11 @@ do
fi
done
-local allowed_commands_array=( update_check.sh command_validate.sh )
+local allowed_commands_array=( update_check.sh command_debug.sh command_start.sh command_validate.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
- if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Teamspeak 3" ]; then
- : # These servers do not require SteamCMD. Check is skipped.
- else
+ if [ -n "${appid}" ]; then
check_steamcmd.sh
fi
fi
@@ -75,4 +73,12 @@ do
if [ "${allowed_command}" == "${function_selfname}" ]; then
check_config.sh
fi
-done
\ No newline at end of file
+done
+
+local allowed_commands_array=( command_details.sh command_monitor.sh command_start.sh command_stop.sh command_ts3_server_pass.sh update_check.sh command_details.sh command_validate.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+ if [ "${allowed_command}" == "${function_selfname}" ]; then
+ check_status.sh
+ fi
+done
diff --git a/functions/check_config.sh b/lgsm/functions/check_config.sh
similarity index 75%
rename from functions/check_config.sh
rename to lgsm/functions/check_config.sh
index 24d32318f..eebb14714 100644
--- a/functions/check_config.sh
+++ b/lgsm/functions/check_config.sh
@@ -1,14 +1,14 @@
#!/bin/bash
# LGSM check_config.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="060116"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: If server config missing warn user.
if [ ! -e "${servercfgfullpath}" ]; then
if [ "${gamename}" != "Hurtworld" ]; then
- fn_printwarnnl "Config file missing!"
+ fn_print_warn_nl "Config file missing!"
echo "${servercfgfullpath}"
fn_scriptlog "Configuration file missing!"
fn_scriptlog "${servercfgfullpath}"
diff --git a/functions/check_deps.sh b/lgsm/functions/check_deps.sh
similarity index 55%
rename from functions/check_deps.sh
rename to lgsm/functions/check_deps.sh
index 88f8fb773..df4b49b4d 100644
--- a/functions/check_deps.sh
+++ b/lgsm/functions/check_deps.sh
@@ -1,102 +1,104 @@
#!/bin/bash
# LGSM check_deps.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Checks that the requires dependencies are installed for LGSM.
fn_deps_detector(){
-# Checks if dependency is missing
-if [ -n "$(command -v dpkg-query)" ]; then
- dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$'
- depstatus=$?
-elif [ -n "$(command -v yum)" ]; then
- yum -q list installed ${deptocheck} > /dev/null 2>&1
- depstatus=$?
-fi
-if [ "${depstatus}" == "0" ]; then
- missingdep=0
- if [ "${function_selfname}" == "command_install.sh" ]; then
- echo -e "\e[0;32m${deptocheck}\e[0m"
- sleep 0.5
- fi
-else
- # if missing dependency is found
- missingdep=1
- if [ "${function_selfname}" == "command_install.sh" ]; then
- echo -e "\e[0;31m${deptocheck}\e[0m"
- sleep 0.5
+ # Checks if dependency is missing
+ if [ -n "$(command -v dpkg-query)" ]; then
+ dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$'
+ depstatus=$?
+ elif [ -n "$(command -v yum)" ]; then
+ yum -q list installed ${deptocheck} > /dev/null 2>&1
+ depstatus=$?
fi
-fi
+ if [ "${depstatus}" == "0" ]; then
+ missingdep=0
+ if [ "${function_selfname}" == "command_install.sh" ]; then
+ echo -e "\e[0;32m${deptocheck}\e[0m"
+ sleep 0.5
+ fi
+ else
+ # if missing dependency is found
+ missingdep=1
+ if [ "${function_selfname}" == "command_install.sh" ]; then
+ echo -e "\e[0;31m${deptocheck}\e[0m"
+ sleep 0.5
+ fi
+ fi
-# Missing dependencies are added to array_deps_missing
-if [ "${missingdep}" == "1" ]; then
- array_deps_missing+=("${deptocheck}")
-fi
+ # Missing dependencies are added to array_deps_missing
+ if [ "${missingdep}" == "1" ]; then
+ array_deps_missing+=("${deptocheck}")
+ fi
}
fn_deps_email(){
-# Adds postfix to required dependencies if email notification is enabled
-if [ "${emailnotification}" == "on" ]; then
- if [ -f /usr/bin/mailx ]; then
- if [ -d /etc/exim4 ]; then
- array_deps_required+=( exim4 )
- elif [ -d /etc/sendmail ]; then
- array_deps_required+=( sendmail )
- elif [ -n "$(command -v dpkg-query)" ]; then
- array_deps_required+=( mailutils postfix )
- elif [ -n "$(command -v yum)" ]; then
- array_deps_required+=( mailx postfix )
- fi
- else
- if [ -n "$(command -v dpkg-query)" ]; then
- array_deps_required+=( mailutils postfix )
- elif [ -n "$(command -v yum)" ]; then
- array_deps_required+=( mailx postfix )
+ # Adds postfix to required dependencies if email alert is enabled
+ if [ "${emailalert}" == "on" ]; then
+ if [ -f /usr/bin/mailx ]; then
+ if [ -d /etc/exim4 ]; then
+ array_deps_required+=( exim4 )
+ elif [ -d /etc/sendmail ]; then
+ array_deps_required+=( sendmail )
+ elif [ -n "$(command -v dpkg-query)" ]; then
+ array_deps_required+=( mailutils postfix )
+ elif [ -n "$(command -v yum)" ]; then
+ array_deps_required+=( mailx postfix )
+ fi
+ else
+ if [ -n "$(command -v dpkg-query)" ]; then
+ array_deps_required+=( mailutils postfix )
+ elif [ -n "$(command -v yum)" ]; then
+ array_deps_required+=( mailx postfix )
+ fi
fi
fi
-fi
}
fn_found_missing_deps(){
-if [ "${#array_deps_missing[@]}" != "0" ]; then
- fn_printdots "Checking dependencies"
- sleep 2
- fn_printwarn "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m"
- sleep 1
- echo -e ""
- sudo -n true > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- fn_printinfonl "Attempting to install missing dependencies automatically"
- echo -en ".\r"
- sleep 1
- echo -en "..\r"
+ if [ "${#array_deps_missing[@]}" != "0" ]; then
+ fn_print_dots "Checking dependencies"
+ sleep 2
+ fn_print_warn "Checking dependencies: missing: \e[0;31m${array_deps_missing[@]}\e[0m"
+ fn_scriptlog "Checking dependencies: missing: \e[0;31m${array_deps_missing[@]}\e[0m"
sleep 1
- echo -en "...\r"
- sleep 1
- echo -en " \r"
- if [ -n "$(command -v dpkg-query)" ]; then
- echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
- elif [ -n "$(command -v yum)" ]; then
- echo "yum install ${array_deps_missing[@]}"
- fi
- else
- echo ""
- fn_printinfomationnl "$(whoami) does not have sudo access. manually install dependencies"
- echo ""
- if [ -n "$(command -v dpkg-query)" ]; then
- echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
- elif [ -n "$(command -v yum)" ]; then
- echo "yum install ${array_deps_missing[@]}"
- fi
- echo ""
- fi
- if [ "${function_selfname}" == "command_install.sh" ]; then
- sleep 5
- fi
-fi
+ echo -e ""
+ sudo -n true > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ fn_print_info_nl "Attempting to install missing dependencies automatically"
+ echo -en ".\r"
+ sleep 1
+ echo -en "..\r"
+ sleep 1
+ echo -en "...\r"
+ sleep 1
+ echo -en " \r"
+ if [ -n "$(command -v dpkg-query)" ]; then
+ echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
+ elif [ -n "$(command -v yum)" ]; then
+ echo "yum install ${array_deps_missing[@]}"
+ fi
+ else
+ echo ""
+ fn_print_infomation_nl "$(whoami) does not have sudo access. Please manually install dependencies"
+ fn_scriptlog "$(whoami) does not have sudo access. Please manually install dependencies"
+ echo ""
+ if [ -n "$(command -v dpkg-query)" ]; then
+ echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
+ elif [ -n "$(command -v yum)" ]; then
+ echo "yum install ${array_deps_missing[@]}"
+ fi
+ echo ""
+ fi
+ if [ "${function_selfname}" == "command_install.sh" ]; then
+ sleep 5
+ fi
+ fi
}
fn_check_loop(){
@@ -110,13 +112,14 @@ fn_check_loop(){
fn_found_missing_deps
}
+info_distro.sh
+
if [ "${function_selfname}" == "command_install.sh" ]; then
echo ""
echo "Checking Dependecies"
echo "================================="
fi
-
# Check will only run if using apt-get or yum
if [ -n "$(command -v dpkg-query)" ]; then
# Generate array of missing deps
@@ -145,7 +148,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
if [ "${engine}" == "spark" ]; then
array_deps_required+=( speex:i386 libtbb2 )
# 7 Days to Die
- elif [ "${executable}" == "./7DaysToDie.sh" ]; then
+ elif [ "${gamename}" == "7 Days To Die" ]; then
array_deps_required+=( telnet expect )
# No More Room in Hell
elif [ "${gamename}" == "No More Room in Hell" ]; then
@@ -159,7 +162,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
elif [ "${executable}" == "./ucc-bin" ]; then
#UT2K4
if [ -f "${executabledir}/ut2004-bin" ]; then
- array_deps_required+=( libsdl1.2debian libstdc++5:i386 bzip2 unzip )
+ array_deps_required+=( libsdl1.2debian libstdc++5:i386 bzip2 )
#UT99
else
array_deps_required+=( libsdl1.2debian bzip2 )
@@ -191,7 +194,7 @@ elif [ -n "$(command -v yum)" ]; then
if [ "${engine}" == "spark" ]; then
array_deps_required+=( speex.i686 tbb.i686 )
# 7 Days to Die
- elif [ "${executable}" == "./7DaysToDie.sh" ]; then
+ elif [ "${gamename}" == "7 Days To Die" ]; then
array_deps_required+=( telnet expect )
# No More Room in Hell
elif [ "${gamename}" == "No More Room in Hell" ]; then
@@ -205,7 +208,7 @@ elif [ -n "$(command -v yum)" ]; then
elif [ "${executable}" == "./ucc-bin" ]; then
#UT2K4
if [ -f "${executabledir}/ut2004-bin" ]; then
- array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 unzip )
+ array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 )
#UT99
else
array_deps_required+=( SDL.i686 bzip2 )
@@ -213,4 +216,4 @@ elif [ -n "$(command -v yum)" ]; then
fi
fn_deps_email
fn_check_loop
-fi
+fi
\ No newline at end of file
diff --git a/lgsm/functions/check_glibc.sh b/lgsm/functions/check_glibc.sh
new file mode 100644
index 000000000..65462d035
--- /dev/null
+++ b/lgsm/functions/check_glibc.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# LGSM check_glibc.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Checks if server has correct glibc or has a fix available.
+
+info_glibc.sh
+info_distro.sh
+
+if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
+ :
+elif [ "${glibcrequired}" == "UNKNOWN" ]; then
+ fn_print_info_nl "Glibc fix: \e[0;31m${glibcrequired}\e[0m"
+ echo -e " * glibc required: \e[0;31m${glibcrequired}\e[0m"
+ echo -e " * glibc installed: ${glibcversion}"
+elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
+ if [ "${glibcfix}" == "yes" ]; then
+ if [ "${function_selfname}" != "command_install.sh" ]; then
+ fn_print_info_nl "Glibc fix: \e[0;32mUsing Glibc fix\e[0m"
+ echo -e " * glibc required: \e[0;31m${glibcrequired}\e[0m"
+ echo -e " * glibc installed: ${glibcversion}"
+ fix_glibc.sh
+ fi
+ else
+ fn_print_warn_nl "Glibc fix: \e[0;31mNo Glibc fix available!\e[0m"
+ echo -en "\n"
+ echo -e " * glibc required: ${glibcrequired}"
+ echo -e " * glibc installed: \e[0;31m${glibcversion}\e[0m"
+ echo -en "\n"
+ fn_print_infomation "The game server will probably not work. A distro upgrade is required!"
+ sleep 5
+ fi
+fi
\ No newline at end of file
diff --git a/functions/check_ip.sh b/lgsm/functions/check_ip.sh
similarity index 77%
rename from functions/check_ip.sh
rename to lgsm/functions/check_ip.sh
index 3e7e86cd3..514949522 100644
--- a/functions/check_ip.sh
+++ b/lgsm/functions/check_ip.sh
@@ -1,15 +1,13 @@
#!/bin/bash
# LGSM check_ip.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# 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".
-if [ "${gamename}" == "Teamspeak 3" ]; then
- :
-else
+if [ "${gamename}" != "Teamspeak 3" ]; then
if [ ! -f "/bin/ip" ]; then
ipcommand="/sbin/ip"
else
@@ -20,12 +18,12 @@ else
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
if [ "${getipwc}" -ge "2" ]; then
- fn_printwarn "Multiple active network interfaces found.\n\n"
+ fn_print_warn "Multiple active network interfaces found.\n\n"
echo -en "Manually specify the IP you want to use within the ${selfname} script.\n"
echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
echo -en "${getip}\n"
echo -en ""
- echo -en "http://gameservermanagers.com/network-interfaces\n"
+ echo -en "https://gameservermanagers.com/network-interfaces\n"
echo -en ""
exit 1
else
diff --git a/functions/check_logs.sh b/lgsm/functions/check_logs.sh
similarity index 58%
rename from functions/check_logs.sh
rename to lgsm/functions/check_logs.sh
index 92ed2cad1..0ab22fb3b 100644
--- a/functions/check_logs.sh
+++ b/lgsm/functions/check_logs.sh
@@ -1,17 +1,16 @@
#!/bin/bash
# LGSM check_logs.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Checks that log files exist on server start
# Create dir's for the script and console logs
if [ ! -d "${scriptlogdir}" ]; then
- fn_printdots "Checking for log files"
+ fn_print_dots "Checking for log files"
sleep 1
- fn_printinfo "Checking for log files: Creating log files"
- echo -en "\n"
+ fn_print_info_nl "Checking for log files: Creating log files"
checklogs=1
install_logs.sh
fi
diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh
new file mode 100644
index 000000000..38aaf3da4
--- /dev/null
+++ b/lgsm/functions/check_permissions.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# LGSM check_permissions.sh
+# Author: Daniel Gibbs
+# Contributor: UltimateByte
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Checks script, files and folders ownership and permissions.
+
+# Useful variables
+currentuser="$(whoami)"
+currentgroups="$(groups)"
+scriptfullpath="${rootdir}/${selfname}"
+conclusionpermissionerror="0"
+
+fn_check_ownership(){
+ # Check script ownership
+ if [ ! -O "${scriptfullpath}" ] && [ ! -G "${scriptfullpath}" ]; then
+ fn_print_fail_nl "Oops ! Ownership issue..."
+ echo " * Current - ${currentuser} - user or its group(s) - ${currentgroups} - does not own \"${selfname}\""
+ echo " * To check the owner and allowed groups, run ls -l \"${selfname}\""
+ exit 1
+ fi
+
+ # Check rootdir ownership
+ if [ ! -O "${rootdir}" ] && [ ! -G "${rootdir}" ]; then
+ fn_print_fail_nl "Oops ! Ownership issue..."
+ echo " * Current - ${currentuser} - user or its group(s) - ${currentgroups} - does not own \"${rootdir}\""
+ echo " * To check the owner and allowed groups, run ls -dl \"${rootdir}\""
+ exit 1
+ fi
+
+ # Check functions ownership
+ funownfail="0"
+ if [ -n "${functionsdir}" ]; then
+ while read -r filename
+ do
+ if [ ! -O "${filename}" ] && [ ! -G "${filename}" ]; then
+ funownfail="1"
+ conclusionpermissionerror="1"
+ fi
+ done <<< "$(find "${functionsdir}" -name "*.sh")"
+
+ if [ "${funownfail}" == "1" ]; then
+ fn_print_fail_nl "Oops ! Ownership issue..."
+ echo " * Current - ${currentuser} - user or its group(s) - ${currentgroups} - does not own all scripts in \"${functionsdir}\""
+ echo " * To check the owner and allowed groups, run ls -l \"${functionsdir}\""
+ fi
+ fi
+}
+
+fn_check_permissions(){
+ # Check rootdir permissions
+ if [ -n "${rootdir}" ]; then
+ # Get permission numbers on folder under the form 775
+ rootdirperm="$(stat -c %a "${rootdir}")"
+ # Grab the first and second digit for user and group permission
+ userrootdirperm="${rootdirperm:0:1}"
+ grouprootdirperm="${rootdirperm:1:1}"
+ if [ "${userrootdirperm}" != "7" ] && [ "${grouprootdirperm}" != "7" ]; then
+ fn_print_fail_nl "Oops ! Permission issue..."
+ echo " * Current - ${currentuser} - user or its group(s) - ${currentgroups} need full control of \"${rootdir}\""
+ echo " * You might wanna run : chmod -R 770 \"${rootdir}\""
+ conclusionpermissionerror="1"
+ fi
+ fi
+
+ # Check functions permissions
+ funcpermfail="0"
+ if [ -n "${functionsdir}" ]; then
+ while read -r filename
+ do
+ funcperm="$(stat -c %a "${filename}")"
+ userfuncdirperm="${funcperm:0:1}"
+ groupfuncdirperm="${funcperm:1:1}"
+ if [ "${userfuncdirperm}" != "7" ] && [ "${groupfuncdirperm}" != "7" ]; then
+ funcpermfail="1"
+ conclusionpermissionerror="1"
+ fi
+ done <<< "$(find "${functionsdir}" -name "*.sh")"
+
+ if [ "${funcpermfail}" == "1" ]; then
+ fn_print_fail_nl "Oops ! Permission issue..."
+ echo " * Current - ${currentuser} - user or its group(s) - ${currentgroups} need full control on scripts in \"${functionsdir}\""
+ echo " * You might wanna run : chmod -R 770 \"${functionsdir}\""
+ fi
+ fi
+}
+
+fn_check_permissions_conclusion(){
+ # Exit if errors found
+ if [ "${conclusionpermissionerror}" == "1" ]; then
+ exit 1
+ fi
+}
+
+fn_check_ownership
+fn_check_permissions
+fn_check_permissions_conclusion
diff --git a/functions/check_root.sh b/lgsm/functions/check_root.sh
similarity index 63%
rename from functions/check_root.sh
rename to lgsm/functions/check_root.sh
index 135c751cf..914069d5c 100644
--- a/functions/check_root.sh
+++ b/lgsm/functions/check_root.sh
@@ -1,11 +1,11 @@
#!/bin/bash
# LGSM check_root.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="060316"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
if [ $(whoami) = "root" ]; then
- fn_printfailnl "Do NOT run this script as root!"
+ fn_print_fail_nl "Do NOT run this script as root!"
if [ -d "${scriptlogdir}" ]; then
fn_scriptlog "${selfname} attempted to run as root."
fi
diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh
new file mode 100644
index 000000000..7eb35ba7b
--- /dev/null
+++ b/lgsm/functions/check_status.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# LGSM check_status function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Checks the proccess status of the server. Either online or offline.
+
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ # 1: Server is running
+ # 0: Server seems to have died
+ # 0: No server running (ts3server.pid is missing)
+ status=$(${executabledir}/ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
+ if [ "${status}" == "Server is running" ]; then
+ status=1
+ else
+ ts3error="${status}"
+ status=0
+ fi
+else
+ status=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
+fi
diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh
new file mode 100644
index 000000000..f8ee2439f
--- /dev/null
+++ b/lgsm/functions/check_steamcmd.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+# LGSM check_steamcmd.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Checks SteamCMD is installed and correct.
+
+
+fn_install_steamcmd(){
+ if [ ! -d "${steamcmddir}" ]; then
+ mkdir -v "${steamcmddir}"
+ fi
+ fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${lgsmdir}/tmp" "steamcmd_linux.tar.gz"
+ fn_dl_extract "${lgsmdir}/tmp" "steamcmd_linux.tar.gz" "${steamcmddir}"
+ chmod +x "${steamcmddir}/steamcmd.sh"
+}
+
+
+fn_check_steamcmd_user(){
+ # Checks steamuser is setup.
+ if [ "${steamuser}" == "username" ]; then
+ fn_print_fail_nl "Steam login not set. Update steamuser."
+ echo " * Change steamuser=\"username\" to a valid steam login."
+ if [ -d "${scriptlogdir}" ]; then
+ fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
+ exit 1
+ fi
+ fi
+ # Anonymous user is set if steamuser is missing
+ if [ -z "${steamuser}" ]; then
+ fn_print_warn_nl "Steam login not set. Using anonymous login."
+ if [ -d "${scriptlogdir}" ]; then
+ fn_scriptlog "Steam login not set. Using anonymous login."
+ fi
+ steamuser="anonymous"
+ steampass=""
+ sleep 2
+ fi
+}
+
+fn_check_steamcmd_sh(){
+ # Checks if SteamCMD exists when starting or updating a server.
+ # Installs if missing.
+ steamcmddir="${rootdir}/steamcmd"
+ if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
+ if [ "${function_selfname}" == "command_install.sh" ]; then
+ fn_install_steamcmd
+ else
+ fn_print_warn_nl "SteamCMD is missing"
+ fn_scriptlog "SteamCMD is missing"
+ sleep 1
+ fn_install_steamcmd
+ fi
+ elif [ "${function_selfname}" == "command_install.sh" ]; then
+ fn_print_infomation "SteamCMD is already installed..."
+ fn_print_ok_eol_nl
+ fi
+}
+
+fn_check_steamcmd_guard(){
+ if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" == "command_validate.sh" ]; then
+ # Checks that steamcmd is working correctly and will prompt Steam Guard if required.
+ "${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
+ if [ $? -ne 0 ]; then
+ fn_print_failure_nl "Error running SteamCMD"
+ fi
+ fi
+}
+
+fn_check_steamcmd_user
+fn_check_steamcmd_sh
+fn_check_steamcmd_guard
\ No newline at end of file
diff --git a/functions/check_systemdir.sh b/lgsm/functions/check_system_dir.sh
similarity index 52%
rename from functions/check_systemdir.sh
rename to lgsm/functions/check_system_dir.sh
index c1f65a0d7..18a0d8019 100644
--- a/functions/check_systemdir.sh
+++ b/lgsm/functions/check_system_dir.sh
@@ -1,11 +1,11 @@
#!/bin/bash
-# LGSM check_systemdir.sh function
+# LGSM check_system_dir.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
if [ ! -d "${systemdir}" ]; then
- fn_printfailnl "Cannot access ${systemdir}: No such directory"
+ fn_print_fail_nl "Cannot access ${systemdir}: No such directory"
if [ -d "${scriptlogdir}" ]; then
fn_scriptlog "Cannot access ${systemdir}: No such directory."
fi
diff --git a/functions/check_tmux.sh b/lgsm/functions/check_tmux.sh
similarity index 74%
rename from functions/check_tmux.sh
rename to lgsm/functions/check_tmux.sh
index ac142ebe4..a2287e375 100644
--- a/functions/check_tmux.sh
+++ b/lgsm/functions/check_tmux.sh
@@ -1,20 +1,20 @@
#!/bin/bash
# LGSM check_tmux.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Checks if tmux is installed as too many users do not RTFM or know how to use Google.
if [ "$(command -v tmux)" ]||[ "$(which tmux >/dev/null 2>&1)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
:
else
- fn_printfailnl "Tmux not installed"
+ fn_print_fail_nl "Tmux not installed"
sleep 1
fn_scriptlog "Tmux is not installed"
echo " * Tmux is required to run this server."
# Suitable passive agressive message
echo " * Please see the the following link."
- echo " * http://gameservermanagers.com/tmux-not-found"
+ echo " * https://gameservermanagers.com/tmux-not-found"
exit 127
fi
diff --git a/functions/command_backup.sh b/lgsm/functions/command_backup.sh
similarity index 59%
rename from functions/command_backup.sh
rename to lgsm/functions/command_backup.sh
index ae50f13be..f5c517129 100644
--- a/functions/command_backup.sh
+++ b/lgsm/functions/command_backup.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM command_backup.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190316"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Creates a .tar.gz file in the backup directory.
@@ -12,11 +12,11 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo ""
-fn_printinfonl "A total of $(du -sh "${rootdir}" --exclude="${backupdir}" | awk '{print $1}') will be compressed into the following backup:"
+fn_print_info_nl "A total of $(du -sh "${rootdir}" --exclude="${backupdir}" | awk '{print $1}') will be compressed into the following backup:"
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
- read -p "Continue? [y/N]" yn
+ read -p "Continue? [Y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return;;
@@ -24,13 +24,13 @@ while true; do
esac
done
echo ""
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
+check_status.sh
+if [ "${status}" != "0" ]; then
echo ""
- fn_printwarningnl "${servicename} is currently running."
+ fn_print_warning_nl "${servicename} is currently running."
sleep 1
while true; do
- read -p "Stop ${servicename} while running the backup? [y/N]" yn
+ read -p "Stop ${servicename} while running the backup? [Y/N]" yn
case $yn in
[Yy]* ) command_stop.sh; break;;
[Nn]* ) break;;
@@ -39,13 +39,13 @@ if [ "${tmuxwc}" -eq 1 ]; then
done
fi
fn_scriptlog "Started backup"
-fn_printdots "Backup in progress, please wait..."
+fn_print_dots "Backup in progress, please wait..."
sleep 2
if [ ! -d "${backupdir}" ]; then
mkdir "${backupdir}"
fi
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
-fn_printoknl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
+fn_print_ok_nl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
fn_scriptlog "Complete, Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
sleep 1
-echo ""
+echo ""
\ No newline at end of file
diff --git a/functions/command_console.sh b/lgsm/functions/command_console.sh
similarity index 66%
rename from functions/command_console.sh
rename to lgsm/functions/command_console.sh
index 4eab4d6eb..966b886b5 100644
--- a/functions/command_console.sh
+++ b/lgsm/functions/command_console.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM command_console.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Gives access to the server tmux console.
@@ -12,29 +12,29 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
echo ""
echo "${gamename} Console"
-echo "============================"
+echo "================================="
echo ""
echo "Press \"CTRL+b d\" to exit console."
-fn_printwarningnl "Do NOT press CTRL+c to exit."
+fn_print_warning_nl "Do NOT press CTRL+c to exit."
echo ""
while true; do
- read -e -i "y" -p "Continue? [y/N]" yn
+ read -e -i "y" -p "Continue? [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return;;
* ) echo "Please answer yes or no.";;
esac
done
-fn_printdots "Starting"
+fn_print_dots "Starting"
sleep 1
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
- fn_printoknl "Starting"
+check_status.sh
+if [ "${status}" != "0" ]; then
+ fn_print_ok_nl "Starting"
fn_scriptlog "accessed"
sleep 1
tmux attach-session -t ${servicename}
else
- fn_printfailnl "Server not running"
+ fn_print_fail_nl "Server not running"
fn_scriptlog "Failed to access: Server not running"
sleep 1
while true; do
diff --git a/functions/command_debug.sh b/lgsm/functions/command_debug.sh
similarity index 79%
rename from functions/command_debug.sh
rename to lgsm/functions/command_debug.sh
index 097ddf289..4710050f2 100644
--- a/functions/command_debug.sh
+++ b/lgsm/functions/command_debug.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM command_debug.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Runs the server without tmux. Runs direct from the terminal.
@@ -15,7 +15,7 @@ info_distro.sh
fn_parms
echo ""
echo "${gamename} Debug"
-echo "============================"
+echo "================================="
echo ""
echo -e "Distro: ${os}"
echo -e "Arch: ${arch}"
@@ -31,7 +31,7 @@ fi
echo ""
echo -e "Use for identifying server issues only!"
echo -e "Press CTRL+c to drop out of debug mode."
-fn_printwarningnl "If ${servicename} is already running it will be stopped."
+fn_print_warning_nl "If ${servicename} is already running it will be stopped."
echo ""
while true; do
read -e -i "y" -p "Continue? [Y/n]" yn
@@ -42,16 +42,14 @@ while true; do
esac
done
fn_scriptlog "Starting debug"
-fn_printinfonl "Stopping any running servers"
+fn_print_info_nl "Stopping any running servers"
fn_scriptlog "Stopping any running servers"
sleep 1
command_stop.sh
-fn_printdots "Starting debug"
+fn_print_dots "Starting debug"
sleep 1
-fn_printok "Starting debug"
+fn_print_ok_nl "Starting debug"
fn_scriptlog "Started debug"
-sleep 1
-echo -en "\n"
cd "${executabledir}"
fix.sh
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh
new file mode 100644
index 000000000..f15380490
--- /dev/null
+++ b/lgsm/functions/command_details.sh
@@ -0,0 +1,611 @@
+#!/bin/bash
+# LGSM command_details.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Displays server infomation.
+
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+# Standard Details
+# This applies to all engines
+
+fn_details_os(){
+ #
+ # Distro Details
+ # =====================================
+ # Distro: Ubuntu 14.04.4 LTS
+ # Arch: x86_64
+ # Kernel: 3.13.0-79-generic
+ # Hostname: hostname
+ # tmux: tmux 1.8
+ # GLIBC: 2.19
+
+ echo -e ""
+ echo -e "\e[93mDistro Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mDistro:\t\e[0m${os}"
+ echo -e "\e[34mArch:\t\e[0m${arch}"
+ echo -e "\e[34mKernel:\t\e[0m${kernel}"
+ echo -e "\e[34mHostname:\t\e[0m$HOSTNAME"
+ echo -e "\e[34mtmux:\t\e[0m${tmuxv}"
+ echo -e "\e[34mGLIBC:\t\e[0m${glibcversion}"
+ } | column -s $'\t' -t
+}
+
+fn_details_performance(){
+ #
+ # Performance
+ # =====================================
+ # Uptime: 55d, 3h, 38m
+ # Avg Load: 1.00, 1.01, 0.78
+ #
+ # Mem: total used free
+ # Physical: 741M 656M 85M
+ # Swap: 0B 0B 0B
+
+ echo -e ""
+ echo -e "\e[93mPerformance\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m"
+ echo -e "\e[34mAvg Load:\t\e[0m${load}"
+ } | column -s $'\t' -t
+ echo -e ""
+ {
+ echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m"
+ echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m"
+ echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m"
+ } | column -s $'\t' -t
+}
+
+fn_details_disk(){
+ #
+ # Storage
+ # =====================================
+ # Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff
+ # Total: 15G
+ # Used: 8.4G
+ # Available: 5.7G
+ # Serverfiles: 961M
+
+ echo -e ""
+ echo -e "\e[93mStorage\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
+ echo -e "\e[34mTotal:\t\e[0m${totalspace}"
+ echo -e "\e[34mUsed:\t\e[0m${usedspace}"
+ echo -e "\e[34mAvailable:\t\e[0m${availspace}"
+ echo -e "\e[34mServerfiles:\t\e[0m${filesdirdu}"
+ if [ -d "${backupdir}" ]; then
+ echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
+ fi
+ } | column -s $'\t' -t
+}
+
+fn_details_gameserver(){
+ #
+ # Quake Live Server Details
+ # =====================================
+ # Server name: ql-server
+ # Server IP: 1.2.3.4:27960
+ # RCON password: CHANGE_ME
+ # Server password: NOT SET
+ # Slots: 16
+ # Status: OFFLINE
+
+ echo -e ""
+ echo -e "\e[92m${gamename} Server Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ # Server name
+ echo -e "\e[34mServer name:\t\e[0m${servername}"
+
+ # Server ip
+ echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}"
+
+ # Server password
+ if [ -n "${serverpassword}" ]; then
+ echo -e "\e[34mServer password:\t\e[0m${serverpassword}"
+ fi
+
+ # RCON password
+ if [ -n "${rconpassword}" ]; then
+ echo -e "\e[34mRCON password:\t\e[0m${rconpassword}"
+ fi
+
+ # Admin password
+ if [ -n "${adminpassword}" ]; then
+ echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}"
+ fi
+
+ # Stats password (Quake Live)
+ if [ -n "${statspassword}" ]; then
+ echo -e "\e[34mStats password:\t\e[0m${statspassword}"
+ fi
+
+ # Slots
+ if [ -n "${slots}" ]; then
+ echo -e "\e[34mSlots:\t\e[0m${slots}"
+ fi
+
+ # Game mode
+ if [ -n "${gamemode}" ]; then
+ echo -e "\e[34mGame mode:\t\e[0m${gamemode}"
+ fi
+
+ # Game world
+ if [ -n "${gameworld}" ]; then
+ echo -e "\e[34mGame world:\t\e[0m${gameworld}"
+ fi
+
+ # Tick rate
+ if [ -n "${tickrate}" ]; then
+ echo -e "\e[34mTick rate:\t\e[0m${tickrate}"
+ fi
+
+ # Teamspeak dbplugin
+ if [ -n "${dbplugin}" ]; then
+ echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}"
+ fi
+
+ # Online status
+ if [ "${status}" == "0" ]; then
+ echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
+ else
+ echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
+ fi
+ } | column -s $'\t' -t
+ echo -e ""
+}
+
+fn_details_script(){
+ #
+ # qlserver Script Details
+ # =====================================
+ # Service name: ql-server
+ # qlserver version: 150316
+ # User: lgsm
+ # Email alert: off
+ # Update on start: off
+ # Location: /home/lgsm/qlserver
+ # Config file: /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
+
+ echo -e "\e[92m${selfname} Script Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ # Service name
+ echo -e "\e[34mService name:\t\e[0m${servicename}"
+
+ # Script version
+ if [ -n "${version}" ]; then
+ echo -e "\e[34m${selfname} version:\t\e[0m${version}"
+ fi
+
+ # User
+ echo -e "\e[34mUser:\t\e[0m$(whoami)"
+
+ # GLIBC required
+ if [ -n "${glibcrequired}" ]; then
+ if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
+ :
+ elif [ "${glibcrequired}" == "UNKNOWN" ]; then
+ echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}"
+ elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
+ if [ "${glibcfix}" == "yes" ]; then
+ echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)"
+ else
+ echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;31mGLIBC version too old\e[0m)"
+ fi
+ else
+ echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m"
+ fi
+ fi
+
+ # Email alert
+ echo -e "\e[34mEmail alert:\t\e[0m${emailalert}"
+
+ # Update on start
+ echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}"
+
+ # Script location
+ echo -e "\e[34mLocation:\t\e[0m${rootdir}"
+
+ # Config file location
+ if [ -n "${servercfgfullpath}" ]; then
+ if [ -f "${servercfgfullpath}" ]; then
+ echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}"
+ else
+ echo -e "\e[34mConfig file:\t\e[0m\e[0;31m${servercfgfullpath}\e[0m (\e[0;31mFILE MISSING\e[0m)"
+ fi
+ fi
+
+ # Network config file location (ARMA 3)
+ if [ -n "${networkcfgfullpath}" ]; then
+ echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}"
+ fi
+ } | column -s $'\t' -t
+}
+
+fn_details_backup(){
+ #
+ # Backups
+ # =====================================
+ # No. of backups: 1
+ # Latest backup:
+ # date: Fri May 6 18:34:19 UTC 2016
+ # file: /home/lgsm/qlserver/backups/ql-server-2016-05-06-183239.tar.gz
+ # size: 945M
+
+ echo -e ""
+ echo -e "\e[92mBackups\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
+ echo -e "No Backups created"
+ else
+ {
+ echo -e "\e[34mNo. of backups:\t\e[0m${backupcount}"
+ echo -e "\e[34mLatest backup:\e[0m"
+ echo -e "\e[34m date:\t\e[0m${lastbackupdate}"
+ echo -e "\e[34m file:\t\e[0m${lastbackup}"
+ echo -e "\e[34m size:\t\e[0m${lastbackupsize}"
+ } | column -s $'\t' -t
+ fi
+}
+
+fn_details_commandlineparms(){
+ #
+ # Command-line Parameters
+ # =====================================
+ # ./run_server_x86.sh +set net_strict 1
+
+ echo -e ""
+ echo -e "\e[92mCommand-line Parameters\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ echo -e "${executable} ${parms}"
+}
+
+fn_details_ports(){
+ # Ports
+ # =====================================
+ # Change ports by editing the parameters in:
+ # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
+
+ echo -e ""
+ echo -e "\e[92mPorts\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ echo -e "Change ports by editing the parameters in:"
+
+ parmslocation="\e[0;31mUNKNOWN\e[0m"
+ local ports_edit_array=( "avalanche" "dontstarve" "projectzomboid" "idtech3" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "Teamspeak 3" "7 Days To Die" )
+ for port_edit in "${ports_edit_array[@]}"
+ do
+ if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
+ parmslocation="${servercfgfullpath}"
+ fi
+ done
+
+ local ports_edit_array=( "starbound" "spark" "source" "goldsource" "Rust" "Hurtworld" )
+ for port_edit in "${ports_edit_array[@]}"
+ do
+ if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
+ parmslocation="${selfname}"
+ fi
+ done
+ echo -e "${parmslocation}"
+ echo -e ""
+ echo -e "Useful port diagnostic command:"
+}
+
+fn_details_statusbottom(){
+ echo -e ""
+ if [ "${status}" == "0" ]; then
+ echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
+ else
+ echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
+ fi
+ echo -e ""
+}
+
+# Engine Specific details
+
+fn_details_avalanche(){
+ echo -e "netstat -atunp | grep Jcmp-Server"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_dontstarve(){
+ echo -e "netstat -atunp | grep dontstarve"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_projectzomboid(){
+ echo -e "netstat -atunp | grep java"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ } | column -s $'\t' -t
+}
+
+
+fn_details_realvirtuality(){
+ echo -e "netstat -atunp | grep arma3server"
+ echo -e ""
+ if [ -z "${port}" ]||[ -z "${queryport}" ]||[ -z "${masterport}" ]; then
+ echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
+ echo -e ""
+ fi
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
+ echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_idtech3(){
+ echo -e "netstat -atunp | grep qzeroded"
+ echo -e ""
+ if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
+ echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
+ echo -e ""
+ fi
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\tudp"
+ echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
+ echo -e "> Stats\tINBOUND\t${statsport}\tudp"
+ } | column -s $'\t' -t
+}
+
+
+fn_details_seriousengine35(){
+ echo -e "netstat -atunp | grep Sam3_Dedicate"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_source(){
+ echo -e "netstat -atunp | grep srcds_linux"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
+ if [ -n "${sourcetvport}" ]; then
+ echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
+ fi
+ echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_spark(){
+ echo -e "netstat -atunp | grep server_linux3"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
+ } | column -s $'\t' -t
+ echo -e ""
+ echo -e "\e[92m${servername} WebAdmin\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}/index.html"
+ echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
+ echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
+ } | column -s $'\t' -t
+}
+
+fn_details_starbound(){
+ echo -e "netstat -atunp | grep starbound"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\ttcp"
+ echo -e "> Query\tINBOUND\t${queryport}\ttcp"
+ echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
+ } | column -s $'\t' -t
+}
+
+fn_details_teamspeak3(){
+ echo -e "netstat -atunp | grep ts3server"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Voice\tINBOUND\t${port}\tudp"
+ echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
+ echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
+ } | column -s $'\t' -t
+}
+
+fn_details_teeworlds(){
+ echo -e "netstat -atunp | grep teeworlds_srv"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\ttcp"
+ } | column -s $'\t' -t
+}
+
+fn_details_terraria(){
+ echo -e "netstat -atunp | grep TerrariaServer"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game\tINBOUND\t${port}\ttcp"
+ } | column -s $'\t' -t
+}
+
+fn_details_sdtd(){
+ echo -e "netstat -atunp | grep 7DaysToDie"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
+ echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
+ } | column -s $'\t' -t
+ echo -e ""
+ echo -e "\e[92m${servername} WebAdmin\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
+ echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
+ echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
+ } | column -s $'\t' -t
+ echo -e ""
+ echo -e "\e[92m${servername} Telnet\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mTelnet enabled:\t\e[0m${telnetenabled}"
+ echo -e "\e[34mTelnet address:\t\e[0m${ip} ${telnetport}"
+ echo -e "\e[34mTelnet password:\t\e[0m${telnetpass}"
+ } | column -s $'\t' -t
+}
+
+fn_details_hurtworld(){
+ echo -e "netstat -atunp | grep Hurtworld"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ } | column -s $'\t' -t
+}
+
+fn_details_rust(){
+ echo -e "netstat -atunp | grep Rust"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+ echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
+ echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
+ } | column -s $'\t' -t
+}
+
+fn_details_unreal(){
+ echo -e "netstat -atunp | grep ucc-bin"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
+ echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ if [ "${engine}" == "unreal" ]; then
+ echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
+ fi
+ if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
+ echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
+ fi
+ if [ "${appid}" == "215360" ]; then
+ echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
+ else
+ echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
+ fi
+ if [ "${appid}" ]; then
+ if [ "${appid}" == "223250" ]; then
+ echo -e "< Steam\tOUTBOUND\t20610\tudp"
+ else
+ echo -e "< Steam\tOUTBOUND\t20660\tudp"
+ fi
+ fi
+ echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
+ } | column -s $'\t' -t
+ echo -e ""
+ echo -e "\e[92m${servername} WebAdmin\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mWebAdmin enabled:\t\e[0m${webadminenabled}"
+ echo -e "\e[34mWebAdmin url:\t\e[0mhttp://${ip}:${webadminport}"
+ echo -e "\e[34mWebAdmin username:\t\e[0m${webadminuser}"
+ echo -e "\e[34mWebAdmin password:\t\e[0m${webadminpass}"
+ } | column -s $'\t' -t
+}
+
+fn_details_ark(){
+ echo -e "netstat -atunp | grep ShooterGame"
+ echo -e ""
+ {
+ echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
+ echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
+ echo -e "> Query\tINBOUND\t${queryport}\tudp"
+ } | column -s $'\t' -t
+}
+
+
+# Run checks and gathers details to display.
+check.sh
+info_config.sh
+info_distro.sh
+info_glibc.sh
+info_parms.sh
+fn_details_os
+fn_details_performance
+fn_details_disk
+fn_details_gameserver
+fn_details_script
+fn_details_backup
+# Some game servers do not have parms.
+if [ "${gamename}" != "Teamspeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
+ fn_parms
+ fn_details_commandlineparms
+fi
+fn_details_ports
+
+# Display details depending on game or engine.
+if [ "${engine}" == "avalanche" ]; then
+ fn_details_avalanche
+elif [ "${engine}" == "dontstarve" ]; then
+ fn_details_dontstarve
+elif [ "${engine}" == "projectzomboid" ]; then
+ fn_details_projectzomboid
+elif [ "${engine}" == "idtech3" ]; then
+ fn_details_idtech3
+elif [ "${engine}" == "realvirtuality" ]; then
+ fn_details_realvirtuality
+elif [ "${engine}" == "seriousengine35" ]; then
+ fn_details_seriousengine35
+elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
+ fn_details_source
+elif [ "${engine}" == "spark" ]; then
+ fn_details_spark
+elif [ "${engine}" == "starbound" ]; then
+ fn_details_starbound
+elif [ "${engine}" == "teeworlds" ]; then
+ fn_details_teeworlds
+elif [ "${engine}" == "terraria" ]; then
+ fn_details_terraria
+elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
+ fn_details_unreal
+elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
+ fn_details_ark
+elif [ "${gamename}" == "Hurtworld" ]; then
+ fn_details_hurtworld
+elif [ "${gamename}" == "7 Days To Die" ]; then
+ fn_details_sdtd
+elif [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_details_teamspeak3
+elif [ "${gamename}" == "Rust" ]; then
+ fn_details_rust
+else
+ fn_print_error_nl "Unable to detect server engine."
+fi
+
+fn_details_statusbottom
\ No newline at end of file
diff --git a/lgsm/functions/command_dev_debug.sh b/lgsm/functions/command_dev_debug.sh
new file mode 100644
index 000000000..625201df0
--- /dev/null
+++ b/lgsm/functions/command_dev_debug.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# LGSM dev_debug.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Dev only: enables debuging log to be saved to dev-debug.log.
+
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+if [ -f ".dev-debug" ]; then
+ rm .dev-debug
+ fn_print_ok_nl "Disabled dev-debug"
+else
+ date > .dev-debug
+ fn_print_ok_nl "Enabled dev-debug"
+fi
\ No newline at end of file
diff --git a/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh
similarity index 98%
rename from functions/command_dev_detect_deps.sh
rename to lgsm/functions/command_dev_detect_deps.sh
index 06bf99599..88c28d5fd 100644
--- a/functions/command_dev_detect_deps.sh
+++ b/lgsm/functions/command_dev_detect_deps.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM fn_dep_detect function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Detects dependencies the server binary requires.
diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh
new file mode 100644
index 000000000..ec7de257e
--- /dev/null
+++ b/lgsm/functions/command_fastdl.sh
@@ -0,0 +1,335 @@
+#!/bin/bash
+# LGSM command_fastdl function
+# Author: Daniel Gibbs
+# Contributor: UltimateByte
+# Website: https://gameservermanagers.com
+lgsm_version="210216"
+
+# Description: Creates a FastDL folder
+
+local modulename="FastDL"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+check.sh
+
+# Directories
+webdir="${rootdir}/www"
+fastdldir="${webdir}/fastdl"
+addonsdir="${systemdir}/addons"
+# Server lua autorun dir, used to autorun lua on client connect to the server
+luasvautorundir="${systemdir}/lua/autorun/server"
+luafastdlfile="lgsm_cl_force_fastdl.lua"
+luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
+
+fn_check_bzip2(){
+ # Returns true if not installed
+ if [ -z "$(command -v bzip2)" ]; then
+ bzip2installed="0"
+ fn_printinfo "bzip2 is not installed !"
+ fn_scriptlog "bzip2 is not installed"
+ echo -en "\n"
+ sleep 1
+ echo "We advise using it"
+ echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/FastDL#bzip2-compression"
+ sleep 2
+ else
+ bzip2installed="1"
+ fi
+}
+
+fn_fastdl_init(){
+ # User confirmation
+ fn_printok "Welcome to LGSM's FastDL generator"
+ sleep 1
+ echo -en "\n"
+ fn_scriptlog "Started FastDL creation"
+ while true; do
+ read -e -i "y" -p "Continue? [Y/n]" yn
+ case $yn in
+ [Yy]* ) break;;
+ [Nn]* ) exit;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+ fn_scriptlog "Initiating FastDL creation"
+
+ # Check and create folders
+ if [ ! -d "${webdir}" ]; then
+ echo ""
+ fn_printinfo "Creating FastDL directories"
+ echo -en "\n"
+ sleep 1
+ fn_printdots "Creating www directory"
+ sleep 0.5
+ mkdir "${webdir}"
+ fn_printok "Created www directory"
+ fn_scriptlog "FastDL created www directory"
+ sleep 1
+ echo -en "\n"
+ fi
+ if [ ! -d "${fastdldir}" ]; then
+ # No folder, won't ask for removing old ones
+ newfastdl=1
+ fn_printdots "Creating fastdl directory"
+ sleep 0.5
+ mkdir "${fastdldir}"
+ fn_printok "Created fastdl directory"
+ fn_scriptlog "FastDL created fastdl directory"
+ sleep 1
+ echo -en "\n"
+ clearoldfastdl="off" # Nothing to clear
+ elif [ "$(ls -A "${fastdldir}")" ]; then
+ newfastdl=0
+ fi
+}
+
+fn_fastdl_config(){
+ # Global settings for FastDL creation
+ fn_printinfo "Entering configuration"
+ fn_scriptlog "Configuration"
+ sleep 2
+ echo -en "\n"
+ # Prompt for clearing old files if folder was already here
+ if [ -n "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then
+ fn_printdots
+ while true; do
+ read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn
+ case $yn in
+ [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;;
+ [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+ echo -en "\n"
+ fi
+ # Prompt for using bzip2 if it's installed
+ if [ ${bzip2installed} == 1 ]; then
+ fn_printdots
+ while true; do
+ read -e -i "y" -p "Enable file compression using bzip2? [Y/n]" yn
+ case $yn in
+ [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;;
+ [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled"; break;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+ echo -en "\n"
+ fi
+}
+
+fn_fastdl_gmod_config(){
+ # Prompt for download enforcer, that is using a .lua addfile resource generator
+ fn_printdots
+ while true; do
+ read -e -i "y" -p "Use client download enforcer? [Y/n]" yn
+ case $yn in
+ [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;;
+ [Nn]* ) luaressource="off"; fn_scriptlog "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+ echo -en "\n"
+}
+
+fn_clear_old_fastdl(){
+ # Clearing old FastDL if user answered yes
+ if [ "${clearoldfastdl}" == "on" ]; then
+ fn_printinfo "Clearing existing FastDL folder"
+ fn_scriptlog "Clearing existing FastDL folder"
+ sleep 0.5
+ rm -R "${fastdldir:?}"/*
+ fn_printok "Old FastDL folder cleared"
+ fn_scriptlog "Old FastDL folder cleared"
+ sleep 1
+ echo -en "\n"
+ fi
+}
+
+fn_gmod_fastdl(){
+ # Copy all needed files for FastDL
+ echo ""
+ fn_printdots "Starting gathering all needed files"
+ fn_scriptlog "Starting gathering all needed files"
+ sleep 1
+ echo -en "\n"
+
+ # No choice to cd to the directory, as find can't then display relative folder
+ cd "${systemdir}"
+
+ # Map Files
+ fn_printdots "Copying map files..."
+ fn_scriptlog "Copying map files"
+ sleep 0.5
+ find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Map files copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Materials
+ fn_printdots "Copying materials..."
+ fn_scriptlog "Copying materials"
+ sleep 0.5
+ find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Materials copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Models
+ fn_printdots "Copying models..."
+ fn_scriptlog "Copying models"
+ sleep 1
+ find . -name '*.vtx' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.phy' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Models copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Particles
+ fn_printdots "Copying particles..."
+ fn_scriptlog "Copying particles"
+ sleep 0.5
+ find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Particles copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Sounds
+ fn_printdots "Copying sounds..."
+ fn_scriptlog "Copying sounds"
+ sleep 0.5
+ find . -name '*.wav' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Sounds copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Resources (mostly fonts)
+ fn_printdots "Copying fonts and png..."
+ fn_scriptlog "Copying fonts and png"
+ sleep 1
+ find . -name '*.otf' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}"
+ find . -name '*.png' | cpio --quiet -updm "${fastdldir}"
+ fn_printok "Fonts and png copied"
+ sleep 0.5
+ echo -en "\n"
+
+ # Going back to rootdir in order to prevent mistakes
+ cd "${rootdir}"
+
+ # Correct addons folder structure for FastDL
+ if [ -d "${fastdldir}/addons" ]; then
+ fn_printinfo "Adjusting addons' file structure"
+ fn_scriptlog "Adjusting addon's file structure"
+ sleep 1
+ cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
+ #Don't remove yet rm -R "${fastdldir:?}/addons"
+ fn_printok "Adjusted addon's file structure"
+ sleep 1
+ echo -en "\n"
+ fi
+
+ # Correct content that may be into a lua folder by mistake like some darkrpmodification addons
+ if [ -d "${fastdldir}/lua" ]; then
+ fn_printdots "Typical DarkRP shit detected, fixing"
+ sleep 2
+ cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
+ fn_printok "Stupid DarkRP file structure fixed"
+ sleep 2
+ echo -en "\n"
+ fi
+}
+
+# Generate lua file that will force download any file into the FastDL folder
+fn_lua_fastdl(){
+ # Remove lua file if luaressource is turned off and file exists
+ echo ""
+ if [ "${luaressource}" == "off" ]; then
+ if [ -f "${luafastdlfullpath}" ]; then
+ fn_printdots "Removing download enforcer"
+ sleep 1
+ rm -R "${luafastdlfullpath:?}"
+ fn_printok "Removed download enforcer"
+ fn_scriptlog "Removed old download inforcer"
+ echo -en "\n"
+ sleep 2
+ fi
+ fi
+ # Remove old lua file and generate a new one if user said yes
+ if [ "${luaressource}" == "on" ]; then
+ if [ -f "${luafastdlfullpath}" ]; then
+ fn_printdots "Removing old download enforcer"
+ sleep 1
+ rm "${luafastdlfullpath}"
+ fn_printok "Removed old download enforcer"
+ fn_scriptlog "Removed old download enforcer"
+ echo -en "\n"
+ sleep 1
+ fi
+ fn_printdots "Generating new download enforcer"
+ fn_scriptlog "Generating new download enforcer"
+ sleep 1
+ # Read all filenames and put them into a lua file at the right path
+ find "${fastdldir}" \( -type f ! -name "*.bz2" \) -printf '%P\n' | while read line; do
+ echo "resource.AddFile( "\""${line}"\"" )" >> ${luafastdlfullpath}
+ done
+ fn_printok "Download enforcer generated"
+ fn_scriptlog "Download enforcer generated"
+ echo -en "\n"
+ echo ""
+ sleep 2
+ fi
+}
+
+fn_fastdl_bzip2(){
+ # Compressing using bzip2 if user said yes
+ echo ""
+ if [ ${bzip2enable} == "on" ]; then
+ fn_printinfo "Have a break, this step could take a while..."
+ echo -en "\n"
+ echo ""
+ fn_printdots "Compressing files using bzip2..."
+ fn_scriptlog "Compressing files using bzip2..."
+ # bzip2 all files that are not already compressed (keeping original files)
+ find "${fastdldir}" \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{\} \;
+ fn_printok "bzip2 compression done"
+ fn_scriptlog "bzip2 compression done"
+ sleep 1
+ echo -en "\n"
+ fi
+}
+
+fn_fastdl_completed(){
+ # Finished message
+ echo ""
+ fn_printok "Congratulations, it's done !"
+ fn_scriptlog "FastDL job done"
+ sleep 2
+ echo -en "\n"
+ echo ""
+ fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/FastDL"
+ echo -en "\n"
+ if [ "$bzip2installed" == "0" ]; then
+ echo "By the way, you'd better install bzip2 an re-run this command !"
+ fi
+ echo "Credits : UltimateByte"
+}
+
+# Game checking and functions running
+# Garry's Mod
+if [ "${gamename}" == "Garry's Mod" ]; then
+ fn_check_bzip2
+ fn_fastdl_init
+ fn_fastdl_config
+ fn_fastdl_gmod_config
+ fn_clear_old_fastdl
+ fn_gmod_fastdl
+ fn_lua_fastdl
+ fn_fastdl_bzip2
+ fn_fastdl_completed
+ exit
+fi
diff --git a/functions/command_install.sh b/lgsm/functions/command_install.sh
similarity index 72%
rename from functions/command_install.sh
rename to lgsm/functions/command_install.sh
index 791cb160d..fb8e7ac1f 100644
--- a/functions/command_install.sh
+++ b/lgsm/functions/command_install.sh
@@ -1,38 +1,38 @@
#!/bin/bash
# LGSM fn_install function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+# Description: Overall function for the installer.
+
+local modulename="Install"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
install_header.sh
-install_serverdir.sh
+install_server_dir.sh
+install_logs.sh
check_deps.sh
# Download and install
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
- install_dl_ut2k4.sh
- install_ut2k4.sh
+ install_server_files.sh
install_ut2k4_key.sh
elif [ "${gamename}" == "Unreal Tournament 99" ]; then
- install_dl_ut99.sh
- install_ut99.sh
+ install_server_files.sh
elif [ "${gamename}" == "Teamspeak 3" ]; then
install_ts3.sh
-elif [ ! -z "${appid}" ]; then
+elif [ -n "${appid}" ]; then
install_steamcmd.sh
- install_serverfiles.sh
+ install_server_files.sh
fi
# Configuration
-fix.sh
-install_logs.sh
-install_gsquery.sh
install_config.sh
if [ "${gamename}" == "Counter Strike: Global Offensive" ]||[ "${gamename}" == "Team Fortress 2" ]||[ "${gamename}" == "BrainBread 2" ]; then
install_gslt.sh
elif [ "${gamename}" == "Teamspeak 3" ]; then
install_ts3db.sh
fi
+fix.sh
install_complete.sh
diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh
new file mode 100644
index 000000000..58b6c90d1
--- /dev/null
+++ b/lgsm/functions/command_monitor.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# LGSM command_monitor.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Monitors server by checking for running proccesses
+# then passes to monitor_gsquery.sh.
+
+local modulename="Monitor"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+fn_monitor_check_lockfile(){
+ # Monitor does not run it lockfile is not found
+ if [ ! -f "${rootdir}/${lockselfname}" ]; then
+ fn_print_info_nl "Disabled: No lock file found"
+ fn_scriptlog "Disabled: No lock file found"
+ echo " * To enable monitor run ./${selfname} start"
+ exit 1
+ fi
+}
+
+fn_monitor_check_update(){
+ # Monitor will not check if update is running.
+ if [ "$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)" != "0" ]; then
+ fn_print_info_nl "SteamCMD is currently checking for updates"
+ fn_scriptlog "SteamCMD is currently checking for updates"
+ sleep 1
+ exit
+ fi
+}
+
+fn_monitor_msg_checking(){
+ fn_print_dots "Checking session: "
+ fn_print_checking_eol
+ fn_scriptlog "Checking session: CHECKING"
+ sleep 1
+}
+
+fn_monitor_teamspeak3(){
+ if [ "${status}" != "0" ]; then
+ fn_print_ok "Checking session: "
+ fn_print_ok_eol_nl
+ fn_scriptlog "Checking session: OK"
+ exit
+ else
+ fn_print_fail "Checking session: ${ts3error}: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Checking session: ${ts3error}: FAIL"
+ failurereason="${ts3error}"
+ alert="restart"
+ alert.sh
+ fi
+ fn_scriptlog "Monitor is starting ${servername}"
+ sleep 1
+ fn_restart
+}
+
+fn_monitor_tmux(){
+ # checks that tmux session is running
+ if [ "${status}" != "0" ]; then
+ fn_print_ok "Checking session: "
+ fn_print_ok_eol_nl
+ fn_scriptlog "Checking session: OK"
+ # runs gsquery check on game with specific engines.
+ local allowed_engines_array=( avalanche goldsource realvirtuality source spark unity3d unreal unreal2 )
+ for allowed_engine in "${allowed_engines_array[@]}"
+ do
+ if [ "${allowed_engine}" == "${function_selfname}" ]; then
+ monitor_gsquery.sh
+ fi
+ done
+ exit
+ else
+ fn_print_fail "Checking session: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Checking session: FAIL"
+ alert="restart"
+ alert.sh
+ fn_scriptlog "Monitor is starting ${servername}"
+ sleep 1
+ command_start.sh
+ fi
+}
+
+check.sh
+logs.sh
+info_config.sh
+fn_print_dots "${servername}"
+fn_scriptlog "${servername}"
+sleep 1
+fn_monitor_check_lockfile
+fn_monitor_check_update
+fn_monitor_msg_checking
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_monitor_teamspeak3
+else
+ fn_monitor_tmux
+fi
\ No newline at end of file
diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh
new file mode 100644
index 000000000..cd34e3f62
--- /dev/null
+++ b/lgsm/functions/command_start.sh
@@ -0,0 +1,187 @@
+#!/bin/bash
+# LGSM command_start.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Starts the server.
+
+local modulename="Starting"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+fn_start_teamspeak3(){
+ if [ ! -e "${servercfgfullpath}" ]; then
+ fn_print_warn_nl "${servercfgfullpath} is missing"
+ fn_scriptlog "${servercfgfullpath} is missing"
+ echo " * Creating blank ${servercfg}"
+ fn_scriptlog "Creating blank ${servercfg}"
+ sleep 2
+ echo " * ${servercfg} can remain blank by default."
+ fn_scriptlog "${servercfgfullpath} can remain blank by default."
+ sleep 2
+ echo " * ${servercfg} is located in ${servercfgfullpath}."
+ fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
+ sleep 5
+ touch "${servercfgfullpath}"
+ fi
+
+ fn_print_dots "${servername}"
+ fn_scriptlog "${servername}"
+ sleep 1
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ fn_print_info_nl "${servername} is already running"
+ fn_scriptlog "${servername} is already running"
+ exit
+ fi
+
+ mv "${scriptlog}" "${scriptlogdate}"
+ # Create lock file
+ date > "${rootdir}/${lockselfname}"
+ cd "${executabledir}"
+ if [ "${ts3serverpass}" == "1" ];then
+ ./ts3server_startscript.sh start serveradmin_password="${newpassword}" inifile="${servercfgfullpath}"
+ else
+ ./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
+ fi
+ sleep 1
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_print_fail_nl "Unable to start ${servername}"
+ fn_scriptlog "Unable to start ${servername}"
+ echo -e " Check log files: ${rootdir}/log"
+ exit 1
+ else
+ fn_print_ok_nl "${servername}"
+ fn_scriptlog "Started ${servername}"
+ fi
+}
+
+fn_start_tmux(){
+ fn_parms
+ fn_print_dots "${servername}"
+ fn_scriptlog "${servername}"
+ sleep 1
+
+ # Log rotation
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_scriptlog "Rotating log files"
+ if [ "${engine}" == "unreal2" ]; then
+ if [ -f "${gamelog}" ]; then
+ mv "${gamelog}" "${gamelogdate}"
+ fi
+ fi
+ mv "${scriptlog}" "${scriptlogdate}"
+ mv "${consolelog}" "${consolelogdate}"
+ fi
+
+ # If server is already running exit
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ fn_print_info_nl "${servername} is already running"
+ fn_scriptlog "${servername} is already running"
+ exit
+ fi
+
+ # Create lock file
+ date > "${rootdir}/${lockselfname}"
+ cd "${executabledir}"
+ tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+
+ # tmux pipe-pane not supported in tmux versions < 1.6
+ if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
+ echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
+ echo "https://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
+ echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+
+ # Console logging disabled: Bug in tmux 1.8 breaks logging
+ elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
+ echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
+ echo "https://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
+ echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+
+ # Console logging enable or not set
+ elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+ touch "${consolelog}"
+ tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
+
+ # Console logging disabled
+ elif [ "${consolelogging}" == "off" ]; then
+ touch "${consolelog}"
+ cat "Console logging disabled by user" >> "{consolelog}"
+ fn_scriptlog "Console logging disabled by user"
+ fi
+ sleep 1
+
+ # If the server fails to start
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_print_fail_nl "Unable to start ${servername}"
+ fn_scriptlog "Unable to start ${servername}"
+ sleep 1
+ if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
+ fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
+ fn_scriptlog "Tmux error"
+ echo ""
+ echo "Command"
+ echo "================================="
+ echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
+ echo ""
+ echo "Error"
+ echo "================================="
+ cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
+
+ # Detected error https://gameservermanagers.com/issues
+ if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
+ echo ""
+ echo "Fix"
+ echo "================================="
+ if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ]; then
+ echo "$(whoami) is not part of the tty group."
+ fn_scriptlog "$(whoami) is not part of the tty group."
+ group=$(grep tty /etc/group)
+ echo ""
+ echo " ${group}"
+ fn_scriptlog "${group}"
+ echo ""
+ echo "Run the following command with root privileges."
+ echo ""
+ echo " usermod -G tty $(whoami)"
+ echo ""
+ echo "https://gameservermanagers.com/tmux-op-perm"
+ fn_scriptlog "https://gameservermanagers.com/tmux-op-perm"
+ else
+ echo "No known fix currently. Please log an issue."
+ fn_scriptlog "No known fix currently. Please log an issue."
+ echo "https://gameservermanagers.com/issues"
+ fn_scriptlog "https://gameservermanagers.com/issues"
+ fi
+ fi
+ fi
+ exit 1
+ else
+ fn_print_ok "${servername}"
+ fn_scriptlog "Started ${servername}"
+ fi
+ rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+ echo -en "\n"
+}
+
+check.sh
+fix.sh
+info_config.sh
+logs.sh
+
+# Will check for updates is updateonstart is yes
+if [ "${status}" == "0" ]; then
+ if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+ update_check.sh
+ fi
+fi
+
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_start_teamspeak3
+else
+ fn_start_tmux
+fi
diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh
new file mode 100644
index 000000000..232bf9f1e
--- /dev/null
+++ b/lgsm/functions/command_stop.sh
@@ -0,0 +1,217 @@
+#!/bin/bash
+# LGSM command_stop.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Stops the server.
+
+local modulename="Stopping"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+# Attempts Graceful of source using rcon 'quit' command.
+fn_stop_graceful_source(){
+ fn_print_dots "Graceful: rcon quit"
+ fn_scriptlog "Graceful: rcon quit"
+ # sends quit
+ tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
+ # waits up to 30 seconds giving the server time to shutdown gracefuly
+ for seconds in {1..30}; do
+ pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+ if [ "${pid}" == "0" ]; then
+ fn_print_ok "Graceful: rcon quit: ${seconds}: "
+ fn_print_ok_eol_nl
+ fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
+ break
+ fi
+ sleep 1
+ fn_print_dots "Graceful: rcon quit: ${seconds}"
+ done
+ if [ "${pid}" != "0" ]; then
+ fn_print_fail "Graceful: rcon quit: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Graceful: rcon quit: FAIL"
+ fn_stop_tmux
+ fi
+ sleep 1
+}
+
+# Attempts Graceful of goldsource using rcon 'quit' command.
+# Goldsource 'quit' command restarts rather than shutsdown
+# this function will only wait 3 seconds then force a tmux shutdown.
+# preventing the server from coming back online.
+fn_stop_graceful_goldsource(){
+ fn_print_dots "Graceful: rcon quit"
+ fn_scriptlog "Graceful: rcon quit"
+ # sends quit
+ tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
+ # waits 3 seconds as goldsource servers restart with the quit command
+ for seconds in {1..3}; do
+ sleep 1
+ fn_print_dots "Graceful: rcon quit: ${seconds}"
+ done
+ fn_print_ok "Graceful: rcon quit: ${seconds}: "
+ fn_print_ok_eol_nl
+ fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
+ sleep 1
+ fn_stop_tmux
+}
+
+# Attempts Graceful of 7 Days To Die using telnet.
+fn_stop_telnet_sdtd(){
+ sdtd_telnet_shutdown=$( expect -c '
+ proc abort {} {
+ puts "Timeout or EOF\n"
+ exit 1
+ }
+ spawn telnet '"${telnetip}"' '"${telnetport}"'
+ expect {
+ "password:" { send "'"${telnetpass}"'\r" }
+ default abort
+ }
+ expect {
+ "session." { send "shutdown\r" }
+ default abort
+ }
+ expect { eof }
+ puts "Completed.\n"
+ ')
+
+}
+
+fn_stop_graceful_sdtd(){
+ fn_print_dots "Graceful: telnet"
+ fn_scriptlog "Graceful: telnet"
+ sleep 1
+ if [ "${telnetenabled}" == "false" ]; then
+ fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
+ elif [ "$(command -v expect)" ]||[ "$(which expect >/dev/null 2>&1)" ]; then
+ # Tries to shutdown with both localhost and server IP.
+ for telnetip in 127.0.0.1 ${ip}; do
+ fn_print_dots "Graceful: telnet: ${telnetip}"
+ fn_scriptlog "Graceful: telnet: ${telnetip}"
+ sleep 1
+ fn_stop_telnet_sdtd
+ completed=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Completed.")
+ refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+ if [ -n "${refused}" ]; then
+ fn_print_warn "Graceful: telnet: ${telnetip}: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Graceful: telnet: ${telnetip}: FAIL"
+ sleep 1
+ elif [ -n "${completed}" ]; then
+ break
+ fi
+ done
+
+ # If telnet was successful will use telnet again to check the connection has closed
+ # This confirms that the tmux session can now be killed.
+ if [ -n "${completed}" ]; then
+ for seconds in {1..30}; do
+ fn_stop_telnet_sdtd
+ refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+ if [ -n "${refused}" ]; then
+ fn_print_ok "Graceful: telnet: ${telnetip}: "
+ fn_print_ok_eol_nl
+ fn_scriptlog "Graceful: telnet: ${telnetip}: ${seconds} seconds"
+ break
+ fi
+ sleep 1
+ fn_print_dots "Graceful: rcon quit: ${seconds}"
+ done
+ # If telnet failed will go straight to tmux shutdown.
+ # If cannot shutdown correctly world save may be lost
+ else
+ if [ -n "${refused}" ]; then
+ fn_print_fail "Graceful: telnet: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Graceful: telnet: ${telnetip}: FAIL"
+ else
+ fn_print_fail_nl "Graceful: telnet: Unknown error"
+ fn_scriptlog "Graceful: telnet: Unknown error"
+ fi
+ echo -en "\n" | tee -a "${scriptlog}"
+ echo -en "Telnet output:" | tee -a "${scriptlog}"
+ echo -en "\n ${sdtd_telnet_shutdown}" | tee -a "${scriptlog}"
+ echo -en "\n\n" | tee -a "${scriptlog}"
+ fi
+ else
+ fn_print_dots "Graceful: telnet: "
+ fn_scriptlog "Graceful: telnet: "
+ fn_print_fail "Graceful: telnet: expect not installed: "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Graceful: telnet: expect not installed: FAIL"
+ fi
+ sleep 1
+ fn_stop_tmux
+}
+
+fn_stop_graceful_select(){
+ if [ "${gamename}" == "7 Days To Die" ]; then
+ fn_stop_graceful_sdtd
+ elif [ "${engine}" == "source" ]; then
+ fn_stop_graceful_source
+ elif [ "${engine}" == "goldsource" ]; then
+ fn_stop_graceful_goldsource
+ else
+ fn_stop_tmux
+ fi
+}
+
+fn_stop_teamspeak3(){
+ fn_print_dots "${servername}"
+ fn_scriptlog "${servername}"
+ sleep 1
+ ${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1
+ # Remove lock file
+ rm -f "${rootdir}/${lockselfname}"
+ fn_print_ok_nl "${servername}"
+ fn_scriptlog "Stopped ${servername}"
+ }
+
+ fn_stop_tmux(){
+ fn_print_dots "${servername}"
+ fn_scriptlog "tmux kill-session: ${servername}"
+ sleep 1
+ # Kill tmux session
+ tmux kill-session -t "${servicename}" > /dev/null 2>&1
+ sleep 0.5
+ pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+ if [ "${pid}" == "0" ]; then
+ # Remove lock file
+ rm -f "${rootdir}/${lockselfname}"
+ fn_print_ok_nl "${servername}"
+ fn_scriptlog "Stopped ${servername}"
+ else
+ fn_print_fail_nl "Unable to stop${servername}"
+ fn_scriptlog "Unable to stop${servername}"
+ fi
+}
+
+# checks if the server is already stopped before trying to stop.
+fn_stop_pre_check(){
+ if [ "${gamename}" == "Teamspeak 3" ]; then
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_print_ok_nl "${servername} is already stopped"
+ fn_scriptlog "${servername} is already stopped"
+ else
+ fn_stop_teamspeak3
+ fi
+ else
+ pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+ if [ "${pid}" == "0" ]; then
+ fn_print_ok_nl "${servername} is already stopped"
+ fn_scriptlog "${servername} is already stopped"
+ else
+ fn_stop_graceful_select
+ fi
+ fi
+}
+
+check.sh
+info_config.sh
+fn_print_dots "${servername}"
+fn_scriptlog "${servername}"
+sleep 1
+fn_stop_pre_check
\ No newline at end of file
diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/functions/command_test_alert.sh
new file mode 100644
index 000000000..339cfeec8
--- /dev/null
+++ b/lgsm/functions/command_test_alert.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# LGSM command_email_test.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Sends a test email alert.
+
+local modulename="Alert"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+check.sh
+info_config.sh
+alert="test"
+alert.sh
diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh
new file mode 100644
index 000000000..982bc53ba
--- /dev/null
+++ b/lgsm/functions/command_ts3_server_pass.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# LGSM command_serveradmin_password.sh function
+# Author: Daniel Gibbs
+# Contributor : UltimateByte
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Changes TS3 serveradmin password
+
+local modulename="Change password"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+
+fn_serveradmin_password_prompt(){
+ echo ""
+ echo "${gamename} ServerAdmin Password Change"
+ echo "================================="
+ echo ""
+ echo "Press \"CTRL+b d\" to exit console."
+ fn_print_infomation_nl "You are about to change the ${gamename} ServerAdmin password."
+ fn_print_warning_nl "${gamename} will restart during this process."
+ echo ""
+ while true; do
+ read -e -i "y" -p "Continue? [Y/n]" yn
+ case $yn in
+ [Yy]* ) break;;
+ [Nn]* ) echo Exiting; exit;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+ fn_scriptlog "Initiating ${gamename} ServerAdmin password change"
+ read -p "Enter new password : " newpassword
+ }
+
+
+ fn_serveradmin_password_set(){
+ fn_print_info_nl "Applying new password"
+ fn_scriptlog "Applying new password"
+ sleep 1
+ # Stop any running server
+ command_stop.sh
+ # Start server in "new password mode"
+ ts3serverpass="1"
+ fn_print_info_nl "Starting server with new password"
+ command_start.sh
+ # Stop server in "new password mode"
+ command_stop.sh
+ ts3serverpass="0"
+ fn_print_ok_nl "Password applied"
+ fn_scriptlog "New ServerAdmin password applied"
+ sleep 1
+}
+
+# Running functions
+check.sh
+fn_serveradmin_password_prompt
+check_status.sh
+if [ "${status}" != "0" ]; then
+ fn_serveradmin_password_set
+ command_start.sh
+else
+ fn_serveradmin_password_set
+fi
\ No newline at end of file
diff --git a/functions/command_update.sh b/lgsm/functions/command_update.sh
similarity index 100%
rename from functions/command_update.sh
rename to lgsm/functions/command_update.sh
diff --git a/lgsm/functions/command_update_functions.sh b/lgsm/functions/command_update_functions.sh
new file mode 100644
index 000000000..ba7674448
--- /dev/null
+++ b/lgsm/functions/command_update_functions.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# LGSM command_update_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
+
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+check.sh
+fn_print_dots "Updating functions"
+fn_scriptlog "Updating functions"
+sleep 1
+echo -ne "\n"
+
+# Removed legecy functions dir
+if [ -n "${rootdir}" ]; then
+ if [ -d "${rootdir}/functions/" ]; then
+ rm -rfv "${rootdir}/functions/"
+ exitcode=$?
+ fi
+fi
+
+if [ -n "${functionsdir}" ]; then
+ if [ -d "${functionsdir}" ]; then
+ rm -rfv "${functionsdir}/"*
+ exitcode=$?
+ fi
+fi
+
+if [ "${exitcode}" == "0" ]; then
+ fn_print_ok "Updating functions"
+ fn_scriptlog "Success! Updating functions"
+else
+ fn_print_fail "Updating functions"
+ fn_scriptlog "Failure! Updating functions"
+fi
+echo -ne "\n"
\ No newline at end of file
diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh
new file mode 100644
index 000000000..9c03e0e56
--- /dev/null
+++ b/lgsm/functions/command_validate.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# LGSM command_validate.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Runs a server validation.
+
+local modulename="Validate"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+fn_validation(){
+ fn_print_warn_nl "Validating may overwrite some customised files."
+ echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
+ sleep 5
+ echo -en "\n"
+ fn_print_dots "Checking server files"
+ sleep 1
+ fn_print_ok "Checking server files"
+ fn_scriptlog "Checking server files"
+ sleep 1
+
+ cd "${rootdir}/steamcmd"
+
+ if [ $(command -v unbuffer) ]; then
+ unbuffer=unbuffer
+ fi
+
+ if [ "${engine}" == "goldsource" ]; then
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit| tee -a "${scriptlog}"
+ else
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit| tee -a "${scriptlog}"
+ fi
+
+ fix.sh
+ fn_scriptlog "Checking complete"
+}
+
+check_status.sh
+if [ "${status}" != "0" ]; then
+ command_stop.sh
+ fn_validation
+ command_start.sh
+else
+ fn_validation
+fi
diff --git a/functions/compress_unreal2_maps.sh b/lgsm/functions/compress_unreal2_maps.sh
similarity index 61%
rename from functions/compress_unreal2_maps.sh
rename to lgsm/functions/compress_unreal2_maps.sh
index 627df96a0..1952dbcad 100644
--- a/functions/compress_unreal2_maps.sh
+++ b/lgsm/functions/compress_unreal2_maps.sh
@@ -1,15 +1,15 @@
#!/bin/bash
# LGSM compress_unreal2_maps.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
clear
echo "${gamename} Map Compressor"
-echo "============================"
+echo "================================="
echo "Will compress all maps in:"
echo ""
pwd
@@ -19,7 +19,7 @@ echo ""
echo "${compressedmapsdir}"
echo ""
while true; do
- read -p "Start compression [y/N]" yn
+ read -e -i "y" -p "Start compression [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return;;
@@ -27,9 +27,9 @@ while true; do
esac
done
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
-rm -rfv "${filesdir}/Maps/*.uz2"
+rm -rfv "${filesdir}/Maps/"*.ut2.uz2
cd "${systemdir}"
-for map in "${filesdir}/Maps/*"; do
- ./ucc-bin compress "../Maps/${map}" --nohomedir
+for map in "${filesdir}/Maps/"*; do
+ ./ucc-bin compress "${map}" --nohomedir
done
-mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}"
+mv -fv "${filesdir}/Maps/"*.ut2.uz2 "${compressedmapsdir}"
diff --git a/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh
similarity index 61%
rename from functions/compress_ut99_maps.sh
rename to lgsm/functions/compress_ut99_maps.sh
index c65ca79bd..bb5f78630 100644
--- a/functions/compress_ut99_maps.sh
+++ b/lgsm/functions/compress_ut99_maps.sh
@@ -1,15 +1,15 @@
#!/bin/bash
# LGSM compress_ut99_maps.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="301215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
clear
echo "${gamename} Map Compressor"
-echo "============================"
+echo "================================="
echo "Will compress all maps in:"
echo ""
pwd
@@ -19,7 +19,7 @@ echo ""
echo "${compressedmapsdir}"
echo ""
while true; do
- read -p "Start compression [y/N]" yn
+ read -e -i "y" -p "Start compression [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return;;
@@ -27,9 +27,9 @@ while true; do
esac
done
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
-rm -rfv "${filesdir}/Maps/*.unr.uz"
+rm -rfv "${filesdir}/Maps/"*.unr.uz
cd "${systemdir}"
-for map in "${filesdir}/Maps/*"; do
- ./ucc-bin compress "../Maps/${map}" --nohomedir
+for map in "${filesdir}/Maps/"*; do
+ ./ucc-bin compress "${map}" --nohomedir
done
-mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}"
+mv -fv "${filesdir}/Maps/"*.unr.uz "${compressedmapsdir}"
diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh
new file mode 100644
index 000000000..a75d2de96
--- /dev/null
+++ b/lgsm/functions/core_dl.sh
@@ -0,0 +1,202 @@
+#!/bin/bash
+# LGSM core_dl.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Deals with all downloads for LGSM.
+
+# fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
+# filedir: location the file is to be saved: /home/server/lgsm/tmp
+# filename: name of file (this can be different from the url name): file.tar.bz2
+# executecmd: Optional, set to "executecmd" to make file executable using chmod +x
+# run: Optional, set to run to execute the file
+# force: Optional, force re-download of file even if exists
+# md5: Optional, Checks file against an md5 sum
+#
+# Downloads can be defined in code like so:
+# fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "executecmd" "run" "force" "10cd7353aa9d758a075c600a6dd193fd"
+
+fn_dl_md5(){
+ # Runs MD5 Check if available
+ if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
+ echo -ne "verifying ${filename} with MD5..."
+ sleep 1
+ local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}')
+ if [ "${md5sumcmd}" != "${md5}" ]; then
+ fn_print_fail_eol_nl
+ echo "${filename} returned MD5 checksum: ${md5sumcmd}"
+ echo "expected MD5 checksum: ${md5}"
+ fn_scriptlog "verifying ${filename} with MD5: FAIL"
+ fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}"
+ fn_scriptlog "expected MD5 checksum: ${md5}"
+ exit 1
+ else
+ fn_print_ok_eol_nl
+ fn_scriptlog "verifying ${filename} with MD5: OK"
+ fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}"
+ fn_scriptlog "expected MD5 checksum: ${md5}"
+ fi
+ fi
+}
+
+# Extracts bzip2 or gzip files
+# Extracts can be defined in code like so:
+# fn_dl_extract "${filedir}" "${filename}" "${extractdir}"
+# fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
+fn_dl_extract(){
+ filedir="${1}"
+ filename="${2}"
+ extractdir="${3}"
+ # extracts archives
+ echo -ne "extracting ${filename}..."
+ fn_scriptlog "extracting download"
+ mime=$(file -b --mime-type "${filedir}/${filename}")
+
+ if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
+ tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}")
+ elif [ "${mime}" == "application/x-bzip2" ]; then
+ tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}")
+ fi
+ local exitcode=$?
+ if [ ${exitcode} -ne 0 ]; then
+ fn_print_fail_eol_nl
+ fn_scriptlog "extracting download: FAIL"
+ echo "${tarcmd}" | tee -a "${scriptlog}"
+ exit ${exitcode}
+ else
+ fn_print_ok_eol_nl
+ fi
+}
+
+# Trap to remove file download if canceled before completed
+fn_fetch_trap() {
+ echo ""
+ echo -ne "downloading ${filename}: "
+ fn_print_canceled_eol_nl
+ fn_scriptlog "downloading ${filename}: CANCELED"
+ sleep 1
+ rm -f "${filedir}/${filename}" | tee -a "${scriptlog}"
+ echo -ne "downloading ${filename}: "
+ fn_print_removed_eol_nl
+ fn_scriptlog "downloading ${filename}: REMOVED"
+ exit
+}
+
+fn_fetch_file(){
+ fileurl="${1}"
+ filedir="${2}"
+ filename="${3}"
+ executecmd="${4:-0}"
+ run="${5:-0}"
+ force="${6:-0}"
+ md5="${7:-0}"
+
+ # If the file is missing, then download
+ if [ ! -f "${filedir}/${filename}" ]; then
+ if [ ! -d "${filedir}" ]; then
+ mkdir -p "${filedir}"
+ fi
+
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ # trap to remove part downloaded files
+ trap fn_fetch_trap INT
+ # if larger file shows progress bar
+ if [ ${filename##*.} == "bz2" ]; then
+ echo -ne "downloading ${filename}..."
+ sleep 1
+ curlcmd=$(${curlcmd} --progress-bar --fail -o "${filedir}/${filename}" "${fileurl}")
+ echo -ne "downloading ${filename}..."
+ else
+ echo -ne " fetching ${filename}...\c"
+ curlcmd=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${fileurl}" 2>&1)
+ fi
+ local exitcode=$?
+ if [ ${exitcode} -ne 0 ]; then
+ fn_print_fail_eol_nl
+ if [ -f "${scriptlog}" ]; then
+ fn_scriptlog "downloading ${filename}: FAIL"
+ fi
+ echo "${curlcmd}" | tee -a "${scriptlog}"
+ echo -e "${fileurl}\n" | tee -a "${scriptlog}"
+ exit ${exitcode}
+ else
+ fn_print_ok_eol_nl
+ if [ -f "${scriptlog}" ]; then
+ fn_scriptlog "downloading ${filename}: OK"
+ fi
+ fi
+ # remove trap
+ trap - INT
+ else
+ fn_print_fail_eol_nl
+ echo "Curl is not installed!"
+ echo -e ""
+ exit 1
+ fi
+ # make file executecmd if executecmd is set
+ if [ "${executecmd}" == "executecmd" ]; then
+ chmod +x "${filedir}/${filename}"
+ fi
+ fi
+
+ if [ -f "${filedir}/${filename}" ]; then
+ fn_dl_md5
+ # run file if run is set
+ if [ "${run}" == "run" ]; then
+ source "${filedir}/${filename}"
+ fi
+ fi
+}
+
+
+
+# fileurl: The directory the file is located in teh GitHub repo
+# filedir: name of file
+# filename: location file to be saved
+# executecmd: set to "executecmd" to make file executecmd
+# run: Optional, set to run to execute the file
+# force: force download of file even if exists
+# md5: Checks fail against an md5 sum
+
+
+# Fetches files from the github repo
+fn_fetch_file_github(){
+ github_file_url_dir="${1}"
+ github_file_url_name="${2}"
+ githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+ fileurl="${githuburl}"
+ filedir="${3}"
+ filename="${github_file_url_name}"
+ executecmd="${4:-0}"
+ run="${5:-0}"
+ force="${6:-0}"
+ md5="${7:-0}"
+ fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+}
+
+
+# Fetches functions
+fn_fetch_function(){
+ github_file_url_dir="lgsm/functions" # github dir containing the file
+ github_file_url_name="${functionfile}" # name of the github file
+ githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+ fileurl="${githuburl}"
+ filedir="${functionsdir}"
+ filename="${github_file_url_name}"
+ executecmd="executecmd"
+ run="run"
+ force="noforce"
+ md5="nomd5"
+ fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+}
\ No newline at end of file
diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh
new file mode 100644
index 000000000..562bed461
--- /dev/null
+++ b/lgsm/functions/core_functions.sh
@@ -0,0 +1,484 @@
+#!/bin/bash
+# LGSM core_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
+# This function is called first before any other function. Without this file other functions would not load.
+
+# Code/functions for legacy servers
+
+fn_functions(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fn_getopt(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# fn_fetch_core_dl also placed here to allow legecy servers to still download core functions
+if [ -z "${lgsmdir}" ]; then
+ lgsmdir="${rootdir}/lgsm"
+ functionsdir="${lgsmdir}/functions"
+ libdir="${lgsmdir}/lib"
+fi
+
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+ if [ ! -d "${filedir}" ]; then
+ mkdir -p "${filedir}"
+ fi
+ echo -e " fetching ${filename}...\c"
+ # Check curl exists and use available path
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+ for curlcmd in ${curlpaths}
+ do
+ if [ -x "${curlcmd}" ]; then
+ break
+ fi
+ done
+ # If curl exists download file
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "${curlfetch}"
+ echo -e "${githuburl}\n"
+ exit 1
+ else
+ echo -e "\e[0;32mOK\e[0m"
+ fi
+ else
+ echo -e "\e[0;31mFAIL\e[0m\n"
+ echo "Curl is not installed!"
+ echo -e ""
+ exit 1
+ fi
+ chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+
+# Core
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_getopt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_messages.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+
+# Command
+
+command_console.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_debug.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_details.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_test_alert.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_backup.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_monitor.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_start.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_stop.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_validate.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_install.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_fastdl.sh(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+command_ts3_server_pass.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fn_restart(){
+local modulename="Restarting"
+info_config.sh
+if [ -d "${scriptlogdir}" ]; then
+ fn_scriptlog "${servername}"
+fi
+command_stop.sh
+command_start.sh
+}
+
+
+# Checks
+
+check.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_config.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_deps.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_glibc.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_ip.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_logs.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_permissions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_root.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_status.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_steamcmd.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_system_dir.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+check_tmux.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Compress
+
+compress_unreal2_maps.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+compress_ut99_maps.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Dev
+
+command_dev_debug.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_dev_detect_deps.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Fix
+
+fix.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_arma3.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_csgo.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_dst.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ins.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_steamcmd.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_glibc.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ro.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_kf.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ut2k4.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Info
+
+info_config.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+info_distro.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+info_glibc.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+info_parms.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Alert
+
+alert.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+alert_email.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+alert_pushbullet.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+# Logs
+
+logs.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Monitor
+
+monitor_gsquery.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Update
+
+update_check.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+command_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+update_dl.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fn_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+#
+## Installer functions
+#
+
+fn_autoinstall(){
+autoinstall=1
+command_install.sh
+}
+
+install_complete.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_config.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_gsquery.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_gslt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_header.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_logs.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_retry.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_server_dir.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+install_server_files.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_steamcmd.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_ts3.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_ts3db.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_ut2k4.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_dl_ut2k4.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+install_ut2k4_key.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+fix_ut99.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
+
+# Calls on-screen messages
+core_messages.sh
+
+#Calls file downloader
+core_dl.sh
diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh
new file mode 100644
index 000000000..d3282cb44
--- /dev/null
+++ b/lgsm/functions/core_getopt.sh
@@ -0,0 +1,441 @@
+#!/bin/bash
+# LGSM core_getopt.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# 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)
+ command_update_functions.sh;;
+ v|validate)
+ command_validate.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ ta|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ c|console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate\t\e[0mu |Checks and applies updates from SteamCMD."
+ echo -e "\e[34mforce-update\t\e[0mfu |Bypasses the check and applies updates from SteamCMD."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mvalidate\t\e[0mv |Validate server files with SteamCMD."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See the output of the server directly to your terminal."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install 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)
+ command_update_functions.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ pw|change-password)
+ command_ts3_server_pass.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate\t\e[0mu |Checks and applies updates from SteamCMD."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mchange-password\t\e[0mpw |Changes TS3 serveradmin password."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install 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)
+ command_update_functions.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ b|backup)
+ command_backup.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See 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)
+ command_update_functions.sh;;
+ v|validate)
+ command_validate.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ c|console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ fd|fastdl)
+ command_fastdl.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
+ echo -e "\e[34mforce-update\t\e[0mfu |Bypasses the check and applies updates from SteamCMD."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mvalidate\t\e[0mv |Validate server files with SteamCMD."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See the output of the server directly to your terminal."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install the server, without prompts."
+ echo -e "\e[34mfastdl\t\e[0mfd |Generates or update a FastDL folder for your server."
+ } | 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)
+ command_update_functions.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ c|console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ mc|map-compressor)
+ compress_ut99_maps.sh;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See the output of the server directly to your terminal."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install the server, without prompts."
+ echo -e "\e[34mmap-compressor\t\e[0mmc |Compresses 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)
+ command_update_functions.sh;;
+ v|validate)
+ command_validate.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ c|console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ mc|map-compressor)
+ compress_unreal2_maps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
+ echo -e "\e[34mforce-update\t\e[0mfu |Bypasses the check and applies updates from SteamCMD."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mvalidate\t\e[0mv |Validate server files with SteamCMD."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See the output of the server directly to your terminal."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install the server, without prompts."
+ echo -e "\e[34mmap-compressor\t\e[0mmc |Compresses 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)
+ command_update_functions.sh;;
+ m|monitor)
+ command_monitor.sh;;
+ et|test-alert)
+ command_test_alert.sh;;
+ dt|details)
+ command_details.sh;;
+ b|backup)
+ command_backup.sh;;
+ c|console)
+ command_console.sh;;
+ d|debug)
+ command_debug.sh;;
+ dev|dev-debug)
+ command_dev_debug.sh;;
+ i|install)
+ command_install.sh;;
+ ai|auto-install)
+ fn_autoinstall;;
+ cd|server-cd-key)
+ install_ut2k4_key.sh;;
+ mc|map-compressor)
+ compress_unreal2_maps.sh;;
+ dd|depsdetect)
+ command_dev_detect_deps.sh;;
+ *)
+ echo "Usage: $0 [option]"
+ echo "${gamename} - Linux Game Server Manager - Version ${version}"
+ echo "https://gameservermanagers.com/${selfname}"
+ echo -e ""
+ echo -e "\e[93mCommands\e[0m"
+ {
+ echo -e "\e[34mstart\t\e[0mst |Start the server."
+ echo -e "\e[34mstop\t\e[0msp |Stop the server."
+ echo -e "\e[34mrestart\t\e[0mr |Restart the server."
+ echo -e "\e[34mupdate-functions\t\e[0muf |Removes all functions so latest can be downloaded."
+ echo -e "\e[34mmonitor\t\e[0mm |Checks that the server is running."
+ echo -e "\e[34mtest-alert\t\e[0mta |Sends test alert."
+ echo -e "\e[34mdetails\t\e[0mdt |Displays useful infomation about the server."
+ echo -e "\e[34mbackup\t\e[0mb |Create archive of the server."
+ echo -e "\e[34mconsole\t\e[0mc |Console allows you to access the live view of a server."
+ echo -e "\e[34mdebug\t\e[0md |See the output of the server directly to your terminal."
+ echo -e "\e[34minstall\t\e[0mi |Install the server."
+ echo -e "\e[34mauto-install\t\e[0mai |Install the server, without prompts."
+ echo -e "\e[34mserver-cd-key\t\e[0mcd |Add your server cd key"
+ echo -e "\e[34mmap-compressor\t\e[0mmc |Compresses 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 [ "${gamename}" == "Garry's Mod" ]; then
+ fn_getopt_gmodserver
+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
diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh
new file mode 100644
index 000000000..523d1c4b2
--- /dev/null
+++ b/lgsm/functions/core_messages.sh
@@ -0,0 +1,204 @@
+#!/bin/bash
+# LGSM fn_messages function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Defines on-screen messages such as [ OK ] and how script logs look.
+
+# nl: new line: message is following by a new line
+# eol: end of line: message is placed at the end of the current line
+
+# Date, servicename & module details displayed in log files.
+# e.g Feb 28 14:56:58 ut99-server: Monitor:
+fn_scriptlog(){
+ if [ -n "${modulename}" ]; then
+ echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}"
+ else
+ echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}"
+ fi
+}
+
+# [ FAIL ]
+fn_print_fail(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@"
+ fi
+}
+
+fn_print_fail_nl(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@"
+ fi
+ sleep 1
+ echo -en "\n"
+}
+
+# [ OK ]
+fn_print_ok(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;32m OK \e[0m] $@"
+ fi
+}
+
+fn_print_ok_nl(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;32m OK \e[0m] $@"
+ fi
+ sleep 1
+ echo -en "\n"
+}
+
+# [ INFO ]
+fn_print_info(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@"
+ fi
+}
+
+fn_print_info_nl(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@"
+ fi
+ sleep 1
+ echo -en "\n"
+}
+
+# [ WARN ]
+fn_print_warn(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@"
+ fi
+}
+
+fn_print_warn_nl(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@"
+ fi
+ sleep 1
+ echo -en "\n"
+}
+
+# [ .... ]
+fn_print_dots(){
+ if [ -n "${modulename}" ]; then
+ echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@"
+ else
+ echo -en "\r\033[K[ .... ] $@"
+ fi
+}
+
+# Complete!
+fn_print_complete(){
+ echo -en "\e[0;32mComplete!\e[0m $@"
+}
+
+fn_print_complete_nl(){
+ echo -e "\e[0;32mComplete!\e[0m $@"
+}
+
+# Warning!
+fn_print_warning(){
+ echo -en "\e[0;33mWarning!\e[0m $@"
+}
+
+fn_print_warning_nl(){
+ echo -e "\e[0;33mWarning!\e[0m $@"
+}
+
+# Failure!
+fn_print_failure(){
+ echo -en "\e[0;31mFailure!\e[0m $@"
+}
+
+fn_print_failure_nl(){
+ echo -e "\e[0;31mFailure!\e[0m $@"
+}
+
+# Error!
+fn_print_error(){
+ echo -en "\e[0;31mError!\e[0m $@"
+}
+
+fn_print_error_nl(){
+ echo -e "\e[0;31mError!\e[0m $@"
+}
+
+# Infomation!
+fn_print_infomation(){
+ echo -en "\e[0;36mInfomation!\e[0m $@"
+}
+
+fn_print_infomation_nl(){
+ echo -e "\e[0;36mInfomation!\e[0m $@"
+}
+
+# FAIL for end of line
+fn_print_ok_eol(){
+ echo -en "\e[0;32mOK\e[0m"
+}
+
+fn_print_ok_eol_nl(){
+ echo -e "\e[0;32mOK\e[0m"
+}
+
+# FAIL for end of line
+fn_print_fail_eol(){
+ echo -en "\e[0;31mFAIL\e[0m"
+}
+
+fn_print_fail_eol_nl(){
+ echo -e "\e[0;31mFAIL\e[0m"
+}
+
+# QUERYING for end of line
+fn_print_querying_eol(){
+ echo -en "\e[0;36mQUERYING\e[0m"
+}
+
+fn_print_querying_eol_nl(){
+ echo -e "\e[0;36mQUERYING\e[0m"
+}
+
+# CHECKING for end of line
+fn_print_checking_eol(){
+ echo -en "\e[0;36mCHECKING\e[0m"
+}
+
+fn_print_checking_eol_nl(){
+ echo -e "\e[0;36mCHECKING\e[0m"
+}
+
+# CANCELED for end of line
+fn_print_canceled_eol(){
+ echo -en "\e[0;33mCANCELED\e[0m"
+}
+
+fn_print_canceled_eol_nl(){
+ echo -e "\e[0;33mCANCELED\e[0m"
+}
+
+# REMOVED for end of line
+fn_print_removed_eol(){
+ echo -en "\e[0;31mREMOVED\e[0m"
+}
+
+fn_print_removed_eol_nl(){
+ echo -e "\e[0;31mREMOVED\e[0m"
+}
\ No newline at end of file
diff --git a/functions/fix.sh b/lgsm/functions/fix.sh
similarity index 66%
rename from functions/fix.sh
rename to lgsm/functions/fix.sh
index 931f4acbe..b862e8278 100644
--- a/functions/fix.sh
+++ b/lgsm/functions/fix.sh
@@ -1,20 +1,39 @@
#!/bin/bash
# LGSM fix.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="020116"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Overall function for managing fixes.
# Runs functions that will fix an issue.
+# Messages that are displayed for some fixes
+fn_fix_msg_start(){
+ fn_print_dots "Applying ${fixname} fix: ${gamename}"
+ sleep 1
+ fn_print_info "Applying ${fixname} fix: ${gamename}"
+ fn_scriptlog "Applying ${fixname} fix: ${gamename}"
+ sleep 1
+}
+
+fn_fix_msg_end(){
+ if [ $? -ne 0 ]; then
+ fn_print_fail_nl "Applying ${fixname} fix: ${gamename}"
+ fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
+ else
+ fn_print_ok_nl "Applying ${fixname} fix: ${gamename}"
+ fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
+ fi
+}
+
+
# Fixes that are run on start
if [ "${function_selfname}" != "command_install.sh" ]; then
- if [ ! -z "${appid}" ]; then
+ if [ -n "${appid}" ]; then
fix_steamcmd.sh
fi
if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
- startfix=1
fix_csgo.sh
elif [ "${gamename}" == "Don't Starve Together" ]; then
fix_dst.sh
@@ -23,11 +42,14 @@ if [ "${function_selfname}" != "command_install.sh" ]; then
elif [ "${gamename}" == "ARMA 3" ]; then
fix_arma3.sh
fi
+
+ if [ "${gamename}" != "Teamspeak 3" ]; then
+ fix_glibc.sh
+ fi
fi
# Fixes that are run on install only.
if [ "${function_selfname}" == "command_install.sh" ]; then
- fix_glibc.sh
if [ "${gamename}" == "Killing Floor" ]; then
echo ""
echo "Applying ${gamename} Server Fixes"
diff --git a/lgsm/functions/fix_arma3.sh b/lgsm/functions/fix_arma3.sh
new file mode 100644
index 000000000..49f4e830e
--- /dev/null
+++ b/lgsm/functions/fix_arma3.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# LGSM fix_arma3.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Fixes: server not always creating steam_appid.txt file.
+if [ ! -d "${rootdir}/.local/share/Arma\ 3" ]; then
+ fixname="20150 Segmentation fault (core dumped)"
+ fn_fix_msg_start
+ mkdir -p "${rootdir}/.local/share/Arma\ 3"
+ fn_fix_msg_end
+fi
\ No newline at end of file
diff --git a/functions/fix_csgo.sh b/lgsm/functions/fix_csgo.sh
similarity index 62%
rename from functions/fix_csgo.sh
rename to lgsm/functions/fix_csgo.sh
index 4227d36eb..0f8a4b8fb 100644
--- a/functions/fix_csgo.sh
+++ b/lgsm/functions/fix_csgo.sh
@@ -1,61 +1,43 @@
#!/bin/bash
# LGSM fix_csgo.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="301215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Resolves various issues with csgo.
-fn_msg_start(){
- fn_printdots "Applying ${fixname} fix: ${gamename}"
- sleep 1
- fn_printinfo "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Applying ${fixname} fix: ${gamename}"
- sleep 1
-}
-
-fn_msg_end(){
- if [ $? -ne 0 ]; then
- fn_printfailnl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
- else
- fn_printoknl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
- fi
-}
-
# Fixes: server not always creating steam_appid.txt file.
if [ ! -f "${filesdir}/steam_appid.txt" ]; then
- local fixname="730 steam_appid.txt"
- fn_msg_start
+ fixname="730 steam_appid.txt"
+ fn_fix_msg_start
echo -n "730" >> "${filesdir}/steam_appid.txt"
- fn_msg_end
+ fn_fix_msg_end
fi
# Fixes: Error parsing BotProfile.db - unknown attribute 'Rank'".
if ! grep -q "//Rank" "${systemdir}/botprofile.db" > /dev/null 2>&1; then
- local fixname="botprofile.db"
- fn_msg_start
+ fixname="botprofile.db"
+ fn_fix_msg_start
sed -i 's/\tRank/\t\/\/Rank/g' "${systemdir}/botprofile.db" > /dev/null 2>&1
- fn_msg_end
+ fn_fix_msg_end
fi
# Fixes: Unknown command "cl_bobamt_vert".
if ! grep -q "//exec default" "${servercfgdir}/valve.rc" > /dev/null 2>&1 || ! grep -q "//exec joystick" "${servercfgdir}/valve.rc" > /dev/null 2>&1; then
- local fixname="valve.rc"
- fn_msg_start
+ fixname="valve.rc"
+ fn_fix_msg_start
sed -i 's/exec default.cfg/\/\/exec default.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
sed -i 's/exec joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
- fn_msg_end
+ fn_fix_msg_end
fi
# Fixes: workshop map issue.
# http://forums.steampowered.com/forums/showthread.php?t=3170366.
if [ -f "${systemdir}/subscribed_collection_ids.txt" ]||[ -f "${systemdir}/subscribed_file_ids.txt" ]||[ -f "${systemdir}/ugc_collection_cache.txt" ]; then
- local fixname="workshop map"
- fn_msg_start
+ fixname="workshop map"
+ fn_fix_msg_start
rm -f "${systemdir}/subscribed_collection_ids.txt"
rm -f "${systemdir}/subscribed_file_ids.txt"
rm -f "${systemdir}/ugc_collection_cache.txt"
- fn_msg_end
+ fn_fix_msg_end
fi
\ No newline at end of file
diff --git a/lgsm/functions/fix_dst.sh b/lgsm/functions/fix_dst.sh
new file mode 100644
index 000000000..1106b58e0
--- /dev/null
+++ b/lgsm/functions/fix_dst.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# LGSM fix_dst.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Resolves various issues with Dont Starve together.
+
+# Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
+# Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
+if [ -f "/etc/redhat-release" ] && [ ! -f "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ]; then
+ fixname="libcurl-gnutls.so.4 missing"
+ fn_fix_msg_start
+ ln -s "/usr/lib/libcurl.so.4" "${filesdir}/bin/lib32/libcurl-gnutls.so.4"
+ fn_fix_msg_end
+fi
\ No newline at end of file
diff --git a/lgsm/functions/fix_glibc.sh b/lgsm/functions/fix_glibc.sh
new file mode 100644
index 000000000..e5ae37ff6
--- /dev/null
+++ b/lgsm/functions/fix_glibc.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# LGSM fix_glibc.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Downloads required glibc files and applys teh glibc fix if required
+
+local libstdc_servers_array=( "ARMA 3" "Blade Symphony" "Garry's Mod" "Just Cause 2" )
+for libstdc_server in "${libstdc_servers_array[@]}"
+do
+ if [ "${gamename}" == "${libstdc_server}" ]; then
+ fn_fetch_file_github "lgsm/lib/ubuntu12.04/i386" "libstdc++.so.6" "${lgsmdir}/lib" "noexecutecmd" "norun" "noforce" "nomd5"
+ fi
+done
+
+local libm_servers_array=( "Double Action: Boogaloo" "Fistful of Frags" "Insurgency" "Natural Selection 2" "NS2: Combat" "No More Room in Hell" )
+for libm_server in "${libm_servers_array[@]}"
+do
+ if [ "${gamename}" == "${libm_server}" ]; then
+ fn_fetch_file_github "lgsm/lib/ubuntu12.04/i386" "libm.so.6" "${lgsmdir}/lib" "noexecutecmd" "norun" "noforce" "nomd5"
+ fi
+done
+
+export LD_LIBRARY_PATH=:"${libdir}"
\ No newline at end of file
diff --git a/functions/fix_ins.sh b/lgsm/functions/fix_ins.sh
similarity index 89%
rename from functions/fix_ins.sh
rename to lgsm/functions/fix_ins.sh
index 210c702ce..5264b5c4e 100644
--- a/functions/fix_ins.sh
+++ b/lgsm/functions/fix_ins.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM fix_ins.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="291215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Resolves various issues with Insurgency.
diff --git a/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh
similarity index 89%
rename from functions/fix_kf.sh
rename to lgsm/functions/fix_kf.sh
index 7e77ca8e6..7b5547851 100644
--- a/functions/fix_kf.sh
+++ b/lgsm/functions/fix_kf.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM fix_kf.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
diff --git a/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh
similarity index 82%
rename from functions/fix_ro.sh
rename to lgsm/functions/fix_ro.sh
index d3d0ac0e2..7e3115f8b 100644
--- a/functions/fix_ro.sh
+++ b/lgsm/functions/fix_ro.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM fix_ro.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Resolves various issues with red orchestra.
echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
diff --git a/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh
similarity index 63%
rename from functions/fix_steamcmd.sh
rename to lgsm/functions/fix_steamcmd.sh
index 862b4736f..736c648f0 100644
--- a/functions/fix_steamcmd.sh
+++ b/lgsm/functions/fix_steamcmd.sh
@@ -1,61 +1,41 @@
#!/bin/bash
# LGSM fix_steamcmd.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="010116"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: fixes various issues related to steamCMD.
-fn_msg_start(){
- fn_printdots "Applying ${fixname} fix: ${gamename}"
- sleep 1
- fn_printinfo "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Applying ${fixname} fix: ${gamename}"
- sleep 1
-}
-
-fn_msg_end(){
- if [ $? -ne 0 ]; then
- fn_printfailnl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
- else
- fn_printoknl "Applying ${fixname} fix: ${gamename}"
- fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
- fi
-}
-
-
# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
- local fixname="steamclient.so general"
- fn_msg_start
+ fixname="steamclient.so general"
+ fn_fix_msg_start
mkdir -pv "${HOME}/.steam/sdk32" >> "${scriptlog}"
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
- fn_msg_end
+ fn_fix_msg_end
fi
if [ "${gamename}" == "Serious Sam 3: BFE" ]; then
# Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory
if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then
- local fixname="libsteam.so"
- fn_msg_start
+ fixname="libsteam.so"
+ fn_fix_msg_start
mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}"
cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}"
- fn_msg_end
+ fn_fix_msg_end
fi
elif [ "${gamename}" == "Hurtworld" ]; then
# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
-
if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
- local fixname="steamclient.so x86"
- fn_msg_start
+ fixname="steamclient.so x86"
+ fn_fix_msg_start
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
- fn_msg_end
+ fn_fix_msg_end
fi
if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
- local fixname="steamclient.so x86_64"
- fn_msg_start
+ fixname="steamclient.so x86_64"
+ fn_fix_msg_start
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
- fn_msg_end
+ fn_fix_msg_end
fi
fi
diff --git a/functions/fix_ut2k4.sh b/lgsm/functions/fix_ut2k4.sh
similarity index 70%
rename from functions/fix_ut2k4.sh
rename to lgsm/functions/fix_ut2k4.sh
index b9ec4ad8a..a0f07ac26 100644
--- a/functions/fix_ut2k4.sh
+++ b/lgsm/functions/fix_ut2k4.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM fix_ut2k4.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Resolves various issues with unreal tournament 2004.
echo "applying WebAdmin ut2003.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
@@ -13,15 +15,10 @@ echo "applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
sleep 1
-echo ""
-echo -en "forcing server restart.\r"
-sleep 0.5
-echo -en "forcing server restart..\r"
-sleep 0.5
-echo -en "forcing server restart...\r"
-sleep 0.5
-echo -en "\n"
-sleep 0.5
+echo "applying server name fix."
+sleep 1
+echo "forcing server restart..."
+sleep 1
command_start.sh
sleep 5
command_stop.sh
diff --git a/functions/fix_ut99.sh b/lgsm/functions/fix_ut99.sh
similarity index 74%
rename from functions/fix_ut99.sh
rename to lgsm/functions/fix_ut99.sh
index d4ceca37f..58644c03d 100644
--- a/functions/fix_ut99.sh
+++ b/lgsm/functions/fix_ut99.sh
@@ -1,9 +1,9 @@
#!/bin/bash
# LGSM fix_ut99.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+echo "${servercfgfullpath}"
echo "enabling UdpServerUplink."
{
echo "[IpServer.UdpServerUplink]"
@@ -12,7 +12,7 @@ echo "UpdateMinutes=1"
echo "MasterServerAddress=unreal.epicgames.com"
echo "MasterServerPort=27900"
echo "Region=0"
-}|tee -a "${servercfgfullpath}" > /dev/null 2>&1
+}| tee -a "${servercfgfullpath}" > /dev/null 2>&1
sleep 1
echo "removing dead gamespy.com master server."
sed -i '/master0.gamespy.com/d' "${servercfgfullpath}"
@@ -21,5 +21,5 @@ echo "removing dead mplayer.com master server."
sed -i '/master.mplayer.com/d' "${servercfgfullpath}"
sleep 1
echo "inserting qtracker.com master server."
-sed -i '66i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${servercfgfullpath}"
+sed -i '65i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${servercfgfullpath}"
echo ""
\ No newline at end of file
diff --git a/lgsm/functions/fn_functions b/lgsm/functions/fn_functions
new file mode 100644
index 000000000..8e1e6c941
--- /dev/null
+++ b/lgsm/functions/fn_functions
@@ -0,0 +1,20 @@
+#!/bin/bash
+# LGSM core_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Redirect to new core_functions.sh
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+core_getopt.sh(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+core_functions.sh
\ No newline at end of file
diff --git a/lgsm/functions/fn_getopt b/lgsm/functions/fn_getopt
new file mode 100644
index 000000000..a9c766583
--- /dev/null
+++ b/lgsm/functions/fn_getopt
@@ -0,0 +1,15 @@
+#!/bin/bash
+# LGSM core_getopt.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Redirect to new core_getopt.sh
+
+core_getopt.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+core_getopt.sh
\ No newline at end of file
diff --git a/lgsm/functions/fn_update_functions b/lgsm/functions/fn_update_functions
new file mode 100644
index 000000000..79bfe3cb6
--- /dev/null
+++ b/lgsm/functions/fn_update_functions
@@ -0,0 +1,22 @@
+#!/bin/bash
+# LGSM fn_update_functions.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub.
+
+fn_print_dots "Updating functions"
+fn_scriptlog "Updating functions"
+sleep 1
+echo -ne "\n"
+rm -rfv "${rootdir}/functions/"*
+exitcode=$?
+if [ "${exitcode}" == "0" ]; then
+ fn_print_ok "Updating functions"
+ fn_scriptlog "Success! Updating functions"
+else
+ fn_print_fail "Updating functions"
+ fn_scriptlog "Failure! Updating functions"
+fi
+echo -ne "\n"
\ No newline at end of file
diff --git a/GameServerQuery/gsquery.py b/lgsm/functions/gsquery.py
similarity index 98%
rename from GameServerQuery/gsquery.py
rename to lgsm/functions/gsquery.py
index b132038e3..8f7b8208c 100644
--- a/GameServerQuery/gsquery.py
+++ b/lgsm/functions/gsquery.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Game Server Query
# Author: Anonymous & Daniel Gibbs
-# # Website: http://gameservermanagers.com
+# # Website: https://gameservermanagers.com
# Version: 190216
import optparse
diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh
new file mode 100644
index 000000000..257f06f16
--- /dev/null
+++ b/lgsm/functions/info_config.sh
@@ -0,0 +1,303 @@
+#!/bin/bash
+# LGSM info_config.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Gets specific details from config files.
+
+## Examples of filtering to get info from config files
+# sed 's/foo//g' - remove foo
+# tr -cd '[:digit:]' leave only digits
+# tr -d '=\"; ' remove selected charectors =\";
+# grep -v "foo" filter out lines that contain foo
+
+unavailable="\e[0;31mUNAVAILABLE\e[0m"
+zero="\e[0;31m0\e[0m"
+
+fn_info_config_avalanche(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ slots="${zero}"
+ port="${zero}"
+ else
+ servername=$(grep "Name" "${servercfgfullpath}" | sed 's/Name//g' | tr -d '=", \n')
+ serverpassword=$(grep "Password" "${servercfgfullpath}" | sed 's/Password//g' | tr -d '=", \n')
+ slots=$(grep "MaxPlayers" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ port=$(grep "BindPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ slots=${slots:-"0"}
+ port=${port:-"0"}
+
+ # check if the ip exists in the config file. Failing this will fall back to the default.
+ ipconfigcheck=$(grep "BindIP" "${servercfgfullpath}" | sed 's/BindIP//g' | tr -d '=", \n')
+ if [ -n "${ipconfigcheck}" ]; then
+ ip="${ipconfigcheck}"
+ fi
+ fi
+}
+
+fn_info_config_dontstarve(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ slots="${zero}"
+ gamemode="${unavailable}"
+ tickrate="${zero}"
+ port="${zero}"
+ else
+ servername=$(grep "default_server_name = " "${servercfgfullpath}" | sed 's/default_server_name = //g')
+ serverpassword=$(grep "server_password = " "${servercfgfullpath}" | grep -v "#" | sed 's/server_password = //g')
+ slots=$(grep "max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ gamemode=$(grep "game_mode = " "${servercfgfullpath}" | grep -v "#" | sed 's/game_mode = //g')
+ tickrate=$(grep "tick_rate" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ slots=${slots:-"0"}
+ gamemode=${gamemode:-"NOT SET"}
+ tickrate=${tickrate:-"0"}
+ port=${port:-"0"}
+ fi
+}
+
+fn_info_config_projectzomboid(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ slots="${zero}"
+ port="${zero}"
+ else
+ servername=$(grep "PublicName=" "${servercfgfullpath}" | sed 's/PublicName=//g' | tr -d '=", \n')
+ slots=$(grep "MaxPlayers=" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ port=$(grep "DefaultPort=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ slots=${slots:-"0"}
+ port=${port:-"0"}
+ fi
+}
+
+fn_info_config_idtech3(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ slots="${zero}"
+ else
+ servername=$(grep "set sv_hostname " "${servercfgfullpath}" | sed 's/set sv_hostname //g' | tr -d '=\"; ')
+ serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed 's/set g_password//g' | tr -d '=\"; '| cut -f1 -d "/")
+ slots=$(grep "set sv_maxClients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ slots=${slots:-"0"}
+ fi
+}
+
+fn_info_config_realvirtuality(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ adminpassword="${unavailable}"
+ serverpassword="${unavailable}"
+ slots="${zero}"
+ else
+ servername=$(grep "hostname" "${servercfgfullpath}" | grep -v "//" | sed 's/\//g' | tr -d '=\"; ')
+ adminpassword=$(grep "passwordAdmin" "${servercfgfullpath}" | grep -v "//" | sed 's/\passwordAdmin//g' | tr -d '=\"; ')
+ serverpassword=$(grep "password =" "${servercfgfullpath}" | grep -v "//" | sed 's/\password//g' | tr -d '=\"; ')
+ slots=$(grep "maxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ adminpassword=${adminpassword:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ slots=${slots:-"0"}
+ fi
+}
+
+fn_info_config_seriousengine35(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ rconpassword="${unavailable}"
+ gamemode="${unavailable}"
+ slots="${zero}"
+ port="${zero}"
+ else
+ servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}" | sed 's/prj_strMultiplayerSessionName = //g' | tr -d '=\"; ')
+ rconpassword=$(grep "rcts_strAdminPassword" "${servercfgfullpath}" | sed 's/rcts_strAdminPassword = //g' | tr -d '=\"; ')
+ gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}" | grep -v "#" | sed 's/gam_idGameMode//g' | tr -d '=\"; ')
+ slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+ port=$(grep "prj_uwPort" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ gamemode=${gamemode:-"NOT SET"}
+ slots=${slots:-"0"}
+ port=${port:-"0"}
+ fi
+}
+
+fn_info_config_source(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ rconpassword="${unavailable}"
+ else
+ servername=$(grep "hostname" "${servercfgfullpath}" | sed 's/hostname //g' | sed 's/"//g')
+ serverpassword=$(grep "sv_password" "${servercfgfullpath}" | sed 's/sv_password //g' | sed 's/"//g')
+ rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed 's/rcon_password //g' | sed 's/"//g')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ fi
+}
+
+fn_info_config_teamspeak3(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ dbplugin="${unavailable}"
+ port="9987"
+ queryport="10011"
+ fileport="30033"
+ else
+ # check if the ip exists in the config file. Failing this will fall back to the default.
+ ipconfigcheck=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/voice_ip=//g')
+ if [ -n "${ipconfigcheck}" ]; then
+ ip="${ipconfigcheck}"
+ fi
+ dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed 's/dbplugin=//g')
+ port=$(grep "default_voice_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ queryport=$(grep "query_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ fileport=$(grep "filetransfer_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ port=${port:-"9987"}
+ queryport=${queryport:-"10011"}
+ fileport=${fileport:-"30033"}
+ fi
+}
+
+fn_info_config_teeworlds(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="unnamed server"
+ serverpassword="${unavailable}"
+ rconpassword="${unavailable}"
+ port="8303"
+ slots="12"
+ else
+ servername=$(grep "sv_name" "${servercfgfullpath}" | sed 's/sv_name //g' | sed 's/"//g')
+ serverpassword=$(grep "password " "${servercfgfullpath}" | awk '!/sv_rcon_password/'| sed 's/password //g' | tr -d '=\"; ')
+ rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed 's/sv_rcon_password //g' | tr -d '=\"; ')
+ port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ slots=$(grep "sv_max_clients" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ port=${port:-"8303"}
+ slots=${slots:-"12"}
+ fi
+}
+
+fn_info_config_terraria(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ port="${zero}"
+ gameworld="${unavailable}"
+ slots="${zero}"
+ else
+ servername=$(grep "worldname=" "${servercfgfullpath}" | sed 's/worldname=//g')
+ port=$(grep "port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ gameworld=$(grep "world=" "${servercfgfullpath}" | sed 's/world=//g')
+ slots=$(grep "maxplayers=" "${servercfgfullpath}" | sed 's/maxplayers=//g')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ port=${port:-"0"}
+ gameworld=${gameworld:-"NOT SET"}
+ slots=${slots:-"0"}
+ fi
+}
+
+fn_info_config_unreal(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ adminpassword="${unavailable}"
+ port="${zero}"
+ gsqueryport="${zero}"
+ webadminenabled="${unavailable}"
+ webadminport="${zero}"
+ webadminuser="${unavailable}"
+ webadminpass="${unavailable}"
+ else
+ servername=$(grep "ServerName=" "${servercfgfullpath}" | sed 's/ServerName=//g')
+ serverpassword=$(grep "GamePassword=" "${servercfgfullpath}" | sed 's/GamePassword=//g')
+ adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/AdminPassword=//g')
+ port=$(grep "Port=" "${servercfgfullpath}" | grep -v "Master" | grep -v "LAN" | grep -v "Proxy" | grep -v "Listen" | tr -d '\r' | tr -cd '[:digit:]')
+ gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
+ webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}" | sed 's/bEnabled=//g' | tr -d '\r')
+ webadminport=$(grep "ListenPort=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
+ if [ "${engine}" == "unreal" ]; then
+ webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}" | sed 's/AdminUsername=//g')
+ webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2 | grep "AdminPassword=" | sed 's/AdminPassword=//g')
+ else
+ webadminuser=$(grep "AdminName=" "${servercfgfullpath}" | sed 's/AdminName=//g')
+ webadminpass="${adminpassword}"
+ fi
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ adminpassword=${adminpassword:-"NOT SET"}
+ port=${port:-"0"}
+ gsqueryport=${gsqueryport:-"0"}
+ webadminenabled=${webadminenabled:-"NOT SET"}
+ webadminport=${webadminport:-"0"}
+ webadminuser=${webadminuser:-"NOT SET"}
+ webadminpass=${webadminpass:-"NOT SET"}
+ fi
+}
+
+## Just Cause 2
+if [ "${engine}" == "avalanche" ]; then
+ fn_info_config_avalanche
+## Dont Starve Together
+elif [ "${engine}" == "dontstarve" ]; then
+ fn_info_config_dontstarve
+## Project Zomboid
+elif [ "${engine}" == "projectzomboid" ]; then
+ fn_info_config_projectzomboid
+# Quake Love
+elif [ "${engine}" == "idtech3" ]; then
+ fn_info_config_idtech3
+# ARMA 3
+elif [ "${engine}" == "realvirtuality" ]; then
+ fn_info_config_realvirtuality
+# Serious Sam
+elif [ "${engine}" == "seriousengine35" ]; then
+ fn_info_config_seriousengine35
+# Source Engine Games
+elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
+ fn_info_config_source
+elif [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_info_config_teamspeak3
+# Teeworlds
+elif [ "${engine}" == "teeworlds" ]; then
+ fn_info_config_teeworlds
+# Terraria
+elif [ "${engine}" == "terraria" ]; then
+ fn_info_config_terraria
+# Unreal/Unreal 2 engine
+elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
+ fn_info_config_unreal
+fi
\ No newline at end of file
diff --git a/functions/info_distro.sh b/lgsm/functions/info_distro.sh
similarity index 93%
rename from functions/info_distro.sh
rename to lgsm/functions/info_distro.sh
index 7dc40c549..81b434f1b 100644
--- a/functions/info_distro.sh
+++ b/lgsm/functions/info_distro.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# LGSM info_distro.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Variables providing useful info on the Operating System such as disk and performace info.
# Used for command_details.sh, command_debug.sh and email.sh.
@@ -23,7 +23,7 @@ fi
# Glibc version number
# e.g: 1.17
-glibcv=$(ldd --version |grep ldd|awk '{print $NF}')
+glibcversion="$(ldd --version | sed -n '1s/.* //p')"
# tmux version
# e.g: tmux 1.6
@@ -70,7 +70,7 @@ usedspace=$(df -hP "${rootdir}" | grep -v "Filesystem" | awk '{print $3}')
availspace=$(df -hP "${rootdir}" | grep -v "Filesystem" | awk '{print $4}')
# used space in serverfiles dir.
-filesdirdu=$(du -sh "${filesdir}" | awk '{print $1}')
+filesdirdu=$(du -sh "${filesdir}" 2> /dev/null | awk '{print $1}')
if [ -z ${filesdirdu} ]; then
filesdirdu="0M"
fi
diff --git a/functions/info_glibc.sh b/lgsm/functions/info_glibc.sh
similarity index 80%
rename from functions/info_glibc.sh
rename to lgsm/functions/info_glibc.sh
index fbef22478..f70086d61 100644
--- a/functions/info_glibc.sh
+++ b/lgsm/functions/info_glibc.sh
@@ -1,12 +1,11 @@
#!/bin/bash
# LGSM info_glibc.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: stores details on servers Glibc requirements.
-
if [ "${gamename}" == "Blade Symphony" ]; then
glibcrequired="2.15"
glibcfix="yes"
@@ -46,7 +45,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
glibcrequired="2.13"
glibcfix="yes"
elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
- glibcrequired="2.07"
+ glibcrequired="2.3.6"
glibcfix="no"
elif [ "${engine}" == "spark" ]; then
glibcrequired="2.15"
@@ -54,12 +53,24 @@ elif [ "${engine}" == "spark" ]; then
elif [ "${engine}" == "starbound" ]; then
glibcrequired="2.12"
glibcfix="no"
+elif [ "${engine}" == "terraria" ]; then
+ glibcrequired="2.7"
+ glibcfix="no"
+elif [ "${engine}" == "unreal" ]; then
+ glibcrequired="2.1"
+ glibcfix="no"
+elif [ "${engine}" == "unreal2" ]; then
+ glibcrequired="2.4"
+ glibcfix="no"
elif [ "${engine}" == "unreal4" ]; then
glibcrequired="2.14"
glibcfix="no"
elif [ "${engine}" == "unity3d" ]; then
glibcrequired="2.15"
glibcfix="no"
+elif [ "${gamename}" == "Teamspeak 3" ]; then
+ glibcrequired="NOT REQUIRED"
+ glibcfix="no"
else
glibcrequired="UNKNOWN"
glibcfix="no"
diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh
new file mode 100644
index 000000000..df70e14f7
--- /dev/null
+++ b/lgsm/functions/info_parms.sh
@@ -0,0 +1,171 @@
+#!/bin/bash
+# LGSM info_parms.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Gets specific details server parameters.
+
+## Examples of filtering to get info from config files
+# sed 's/foo//g' - remove foo
+# tr -cd '[:digit:]' leave only digits
+# tr -d '=\"; ' remove selected charectors =\";
+# grep -v "foo" filter out lines that contain foo
+
+unavailable="\e[0;31mUNAVAILABLE\e[0m"
+zero="\e[0;31m0\e[0m"
+
+
+fn_info_config_idtech3(){
+ # Not Set
+ port=${port:-"NOT SET"}
+ rconport=${rconport:-"0"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ statsport=${statsport:-"0"}
+ statspassword=${statspassword:-"NOT SET"}
+ mappool=${mappool:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+}
+
+fn_info_config_realvirtuality(){
+ # Not Set
+ port=${rconport:-"0"}
+}
+
+fn_info_config_source(){
+ defaultmap=${defaultmap:-"NOT SET"}
+ maxplayers=${maxplayers:-"0"}
+ port=${port:-"0"}
+ clientport=${clientport:-"0"}
+}
+
+fn_info_config_teamspeak3(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ dbplugin="${unavailable}"
+ port="9987"
+ queryport="10011"
+ fileport="30033"
+ else
+ # check if the ip exists in the config file. Failing this will fall back to the default.
+ ipconfigcheck=$(grep "voice_ip=" "${servercfgfullpath}" | sed 's/\voice_ip=//g')
+ if [ -n "${ipconfigcheck}" ]; then
+ ip="${ipconfigcheck}"
+ fi
+ dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed 's/\dbplugin=//g')
+ port=$(grep "default_voice_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ queryport=$(grep "query_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ fileport=$(grep "filetransfer_port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ port=${port:-"9987"}
+ queryport=${queryport:-"10011"}
+ fileport=${fileport:-"30033"}
+ fi
+}
+
+fn_info_config_teeworlds(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="unnamed server"
+ serverpassword="${unavailable}"
+ rconpassword="${unavailable}"
+ port="8303"
+ slots="12"
+ else
+ servername=$(grep "sv_name" "${servercfgfullpath}" | sed 's/sv_name //g' | sed 's/"//g')
+ serverpassword=$(grep "password " "${servercfgfullpath}" | awk '!/sv_rcon_password/'| sed 's/password //g' | tr -d '=\"; ')
+ rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed 's/sv_rcon_password //g' | tr -d '=\"; ')
+ port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
+ slots=$(grep "sv_max_clients" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ rconpassword=${rconpassword:-"NOT SET"}
+ port=${port:-"8303"}
+ slots=${slots:-"12"}
+ fi
+}
+
+fn_info_config_terraria(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ port="0"
+ else
+ port=$(grep "port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+ # Not Set
+ port=${port:-"0"}
+ fi
+}
+
+fn_info_config_unreal(){
+ if [ ! -f "${servercfgfullpath}" ]; then
+ servername="${unavailable}"
+ serverpassword="${unavailable}"
+ adminpassword="${unavailable}"
+ port="${zero}"
+ gsqueryport="${zero}"
+ webadminenabled="${unavailable}"
+ webadminport="${zero}"
+ webadminuser="${unavailable}"
+ webadminpass="${unavailable}"
+ else
+ servername=$(grep "ServerName=" "${servercfgfullpath}" | sed 's/ServerName=//g')
+ serverpassword=$(grep "GamePassword=" "${servercfgfullpath}" | sed 's/GamePassword=//g')
+ adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/AdminPassword=//g')
+ port=$(grep "Port=" "${servercfgfullpath}" | grep -v "Master" | grep -v "LAN" | grep -v "Proxy" | grep -v "Listen" | tr -d '\r' | tr -cd '[:digit:]')
+ gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
+ webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}" | sed 's/bEnabled=//g' | tr -d '\r')
+ webadminport=$(grep "ListenPort=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
+ if [ "${engine}" == "unreal" ]; then
+ webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}" | sed 's/\AdminUsername=//g')
+ webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2 | grep "AdminPassword=" | sed 's/\AdminPassword=//g')
+ else
+ webadminuser=$(grep "AdminName=" "${servercfgfullpath}" | sed 's/\AdminName=//g')
+ webadminpass=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/\AdminPassword=//g')
+ fi
+
+ # Not Set
+ servername=${servername:-"NOT SET"}
+ serverpassword=${serverpassword:-"NOT SET"}
+ adminpassword=${adminpassword:-"NOT SET"}
+ port=${port:-"0"}
+ gsqueryport=${gsqueryport:-"NOT SET"}
+ webadminenabled=${webadminenabled:-"NOT SET"}
+ webadminport=${webadminport:-"NOT SET"}
+ webadminuser=${webadminuser:-"NOT SET"}
+ webadminpass=${webadminpass:-"NOT SET"}
+ fi
+}
+
+## Just Cause 2
+if [ "${engine}" == "avalanche" ]; then
+ fn_info_config_avalanche
+## Dont Starve Together
+elif [ "${engine}" == "dontstarve" ]; then
+ fn_info_config_dontstarve
+## Project Zomboid
+elif [ "${engine}" == "projectzomboid" ]; then
+ fn_info_config_projectzomboid
+# Quake Live
+elif [ "${engine}" == "idtech3" ]; then
+ fn_info_config_idtech3
+# ARMA 3
+elif [ "${engine}" == "realvirtuality" ]; then
+ fn_info_config_realvirtuality
+# Serious Sam
+elif [ "${engine}" == "seriousengine35" ]; then
+ fn_info_config_seriousengine35
+# Source Engine Games
+elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
+ fn_info_config_source
+elif [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_info_config_teamspeak3
+# Teeworlds
+elif [ "${engine}" == "teeworlds" ]; then
+ fn_info_config_teeworlds
+elif [ "${engine}" == "terraria" ]; then
+ fn_info_config_terraria
+# Unreal/Unreal 2 engine
+elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
+ fn_info_config_unreal
+fi
\ No newline at end of file
diff --git a/functions/install_complete.sh b/lgsm/functions/install_complete.sh
similarity index 69%
rename from functions/install_complete.sh
rename to lgsm/functions/install_complete.sh
index a782b4f7a..f4b885a15 100644
--- a/functions/install_complete.sh
+++ b/lgsm/functions/install_complete.sh
@@ -1,17 +1,20 @@
#!/bin/bash
# LGSM install_complete.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
if [ "${gamename}" == "Don't Starve Together" ]; then
echo ""
echo "An Authentication Token is required to run this server!"
echo "Follow the instructions in this link to obtain this key"
- echo " http://gameservermanagers.com/dst-auth-token"
+ echo " https://gameservermanagers.com/dst-auth-token"
fi
echo "================================="
echo "Install Complete!"
+fn_scriptlog "Install Complete!"
echo ""
echo "To start server type:"
echo "./${selfname} start"
diff --git a/functions/install_config.sh b/lgsm/functions/install_config.sh
similarity index 75%
rename from functions/install_config.sh
rename to lgsm/functions/install_config.sh
index 41ccf8cc8..e6a298e05 100644
--- a/functions/install_config.sh
+++ b/lgsm/functions/install_config.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM install_config.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="220216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
fn_defaultconfig(){
echo "creating ${servercfg} config file."
@@ -11,133 +13,133 @@ fn_defaultconfig(){
}
fn_userinputconfig(){
-# allow user to input server name and password
-if [ -z "${autoinstall}" ]; then
- echo ""
- echo "Configuring ${gamename} Server"
- echo "================================="
- sleep 1
- read -p "Enter server name: " servername
- read -p "Enter rcon password: " rconpass
-else
- servername="${servicename}"
- rconpass="rconpassword"
-fi
-echo "changing hostname."
-sed -i "s/\"\"/\"${servername}\"/g" "${servercfgfullpath}"
-sleep 1
-echo "changing rconpassword."
-sed -i "s/\"\"/\"${rconpass}\"/g" "${servercfgfullpath}"
-sleep 1
-}
+ # allow user to input server name and password
+ if [ -z "${autoinstall}" ]; then
+ echo ""
+ echo "Configuring ${gamename} Server"
+ echo "================================="
+ sleep 1
+ read -p "Enter server name: " servername
+ read -p "Enter rcon password: " rconpass
+ else
+ servername="${servicename}"
+ rconpass="rconpassword"
+ fi
+ echo "changing hostname."
+ sed -i "s/\"\"/\"${servername}\"/g" "${servercfgfullpath}"
+ sleep 1
+ echo "changing rconpassword."
+ sed -i "s/\"\"/\"${rconpass}\"/g" "${servercfgfullpath}"
+ sleep 1
+ }
fn_arma3config(){
-fn_defaultconfig
-echo "creating ${networkcfg} config file."
-cp -v "${networkcfgdefault}" "${networkcfgfullpath}"
-sleep 1
-echo ""
+ fn_defaultconfig
+ echo "creating ${networkcfg} config file."
+ cp -v "${networkcfgdefault}" "${networkcfgfullpath}"
+ sleep 1
+ echo ""
}
fn_goldsourceconfig(){
-fn_defaultconfig
+ fn_defaultconfig
-# server.cfg redirects to ${servercfg} for added security
-echo "creating server.cfg."
-touch "server.cfg"
-sleep 1
-echo "creating redirect."
-echo "server.cfg > ${servercfg}."
-echo "exec ${servercfg}" > "server.cfg"
-sleep 1
+ # server.cfg redirects to ${servercfg} for added security
+ echo "creating server.cfg."
+ touch "server.cfg"
+ sleep 1
+ echo "creating redirect."
+ echo "server.cfg > ${servercfg}."
+ echo "exec ${servercfg}" > "server.cfg"
+ sleep 1
-# creating other files required
-echo "creating listip.cfg."
-touch "${systemdir}/listip.cfg"
-sleep 1
-echo "creating banned.cfg."
-touch "${systemdir}/banned.cfg"
-sleep 1
+ # creating other files required
+ echo "creating listip.cfg."
+ touch "${systemdir}/listip.cfg"
+ sleep 1
+ echo "creating banned.cfg."
+ touch "${systemdir}/banned.cfg"
+ sleep 1
-fn_userinputconfig
-echo ""
+ fn_userinputconfig
+ echo ""
}
fn_serious3config(){
-fn_defaultconfig
-echo ""
-echo "To edit ${gamename} server config use SS3 Server GUI 3 tool"
-echo "http://mrag.nl/sgui3/"
-sleep 1
-echo ""
+ fn_defaultconfig
+ echo ""
+ echo "To edit ${gamename} server config use SS3 Server GUI 3 tool"
+ echo "http://mrag.nl/sgui3/"
+ sleep 1
+ echo ""
}
fn_sourceconfig(){
-fn_defaultconfig
+ fn_defaultconfig
-# server.cfg redirects to ${servercfg} for added security
-echo "creating server.cfg."
-touch "server.cfg"
-sleep 1
-echo "creating redirect."
-echo "server.cfg > ${servercfg}."
-echo "exec ${servercfg}" > "server.cfg"
-sleep 1
+ # server.cfg redirects to ${servercfg} for added security
+ echo "creating server.cfg."
+ touch "server.cfg"
+ sleep 1
+ echo "creating redirect."
+ echo "server.cfg > ${servercfg}."
+ echo "exec ${servercfg}" > "server.cfg"
+ sleep 1
-fn_userinputconfig
-echo ""
+ fn_userinputconfig
+ echo ""
}
fn_teeworldsconfig(){
-fn_defaultconfig
+ fn_defaultconfig
-echo "adding logfile location to config."
-sed -i "s@\"\"@\"${gamelog}\"@g" "${servercfgfullpath}"
-sleep 1
-echo "removing password holder."
-sed -i "s///" "${servercfgfullpath}"
-sleep 1
+ echo "adding logfile location to config."
+ sed -i "s@\"\"@\"${gamelog}\"@g" "${servercfgfullpath}"
+ sleep 1
+ echo "removing password holder."
+ sed -i "s///" "${servercfgfullpath}"
+ sleep 1
-fn_userinputconfig
-echo ""
+ fn_userinputconfig
+ echo ""
}
fn_ut99config(){
-echo "${defaultcfg} > ${servercfgfullpath}"
-tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
-sleep 1
-echo ""
-echo "Configuring ${gamename} Server"
-echo "================================="
-sleep 1
-echo "enabling WebAdmin."
-sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
-sleep 1
-echo "setting WebAdmin port to 8076."
-sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
-sleep 1
-echo ""
+ echo "${servercfgdefault} > ${servercfgfullpath}"
+ tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
+ sleep 1
+ echo ""
+ echo "Configuring ${gamename} Server"
+ echo "================================="
+ sleep 1
+ echo "enabling WebAdmin."
+ sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
+ sleep 1
+ echo "setting WebAdmin port to 8076."
+ sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
+ sleep 1
+ echo ""
}
fn_unreal2config(){
-fn_defaultconfig
-echo ""
-echo "Configuring ${gamename} Server"
-echo "================================="
-sleep 1
-echo "setting WebAdmin username and password."
-sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
-sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
-sleep 1
-echo "enabling WebAdmin."
-sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
-if [ "${gamename}" == "Unreal Tournament 2004" ]; then
+ fn_defaultconfig
+ echo ""
+ echo "Configuring ${gamename} Server"
+ echo "================================="
sleep 1
- echo "setting WebAdmin port to 8075."
- sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
-fi
-sleep 1
-echo ""
+ echo "setting WebAdmin username and password."
+ sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
+ sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
+ sleep 1
+ echo "enabling WebAdmin."
+ sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
+ if [ "${gamename}" == "Unreal Tournament 2004" ]; then
+ sleep 1
+ echo "setting WebAdmin port to 8075."
+ sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
+ fi
+ sleep 1
+ echo ""
}
echo ""
@@ -185,7 +187,6 @@ elif [ "${gamename}" == "Codename CURE" ]; then
wget -N /dev/null ${githuburl}/CodenameCURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
-
elif [ "${gamename}" == "Counter Strike 1.6" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N /dev/null ${githuburl}/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
@@ -283,7 +284,12 @@ elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N /dev/null ${githuburl}/PiratesVikingandKnightsII/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
- fn_sourceconfig
+ fn_sourceconfig
+elif [ "${gamename}" == "Project Zomboid" ]; then
+ echo -e "downloading lgsm-default.ini...\c"
+ wget -N /dev/null ${githuburl}/ProjectZomboid/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+ sleep 1
+ fn_defaultconfig
elif [ "${gamename}" == "Quake Live" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N /dev/null ${githuburl}/QuakeLive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
diff --git a/lgsm/functions/install_gslt.sh b/lgsm/functions/install_gslt.sh
new file mode 100644
index 000000000..96cb21459
--- /dev/null
+++ b/lgsm/functions/install_gslt.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# LGSM install_gslt.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Configures GSLT.
+
+local modulename="Install"
+
+echo ""
+echo "Game Server Login Token"
+echo "================================="
+sleep 1
+if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
+ echo "GSLT is required to run a public ${gamename} server"
+ fn_scriptlog "GSLT is required to run a public ${gamename} server"
+else
+ echo "GSLT is an optional feature for ${gamename} server"
+ fn_scriptlog "GSLT is an optional feature for ${gamename} server"
+fi
+
+echo "Get more info and a token here:"
+echo "https://gameservermanagers.com/gslt"
+fn_scriptlog "Get more info and a token here:"
+fn_scriptlog "https://gameservermanagers.com/gslt"
+echo ""
+if [ -z "${autoinstall}" ]; then
+ echo "Enter token below (Can be blank)."
+ echo -n "GSLT TOKEN: "
+ read token
+ sed -i -e "s/gslt=\"\"/gslt=\"${token}\"/g" "${rootdir}/${selfname}"
+fi
+sleep 1
+echo "The GSLT can be changed by editing ${selfname}."
+fn_scriptlog "The GSLT can be changed by editing ${selfname}."
+echo ""
\ No newline at end of file
diff --git a/functions/install_gsquery.sh b/lgsm/functions/install_gsquery.sh
similarity index 70%
rename from functions/install_gsquery.sh
rename to lgsm/functions/install_gsquery.sh
index 1f2f16bdc..2edb28e94 100644
--- a/functions/install_gsquery.sh
+++ b/lgsm/functions/install_gsquery.sh
@@ -1,20 +1,20 @@
#!/bin/bash
# LGSM install_gsquery.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
fn_dlgsquery(){
-cd "${rootdir}"
-echo -e "downloading gsquery.py...\c"
-wget -N /dev/null "http://gameservermanagers.com/dl/gsquery.py" 2>&1 | grep -F "HTTP" | grep -v "Moved Permanently" | cut -c45- | uniq
-chmod +x gsquery.py
+ cd "${rootdir}"
+ echo -e "downloading gsquery.py...\c"
+ wget -N /dev/null "https://gameservermanagers.com/dl/gsquery.py" 2>&1 | grep -F "HTTP" | grep -v "Moved Permanently" | cut -c45- | uniq
+ chmod +x gsquery.py
}
if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${gamename}" == "Hurtworld" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
echo ""
echo "GameServerQuery"
- echo "============================"
+ echo "================================="
if [ -z ${autoinstall} ]; then
while true; do
read -e -i "y" -p "Do you want to install GameServerQuery? [Y/n]" yn
diff --git a/functions/install_header.sh b/lgsm/functions/install_header.sh
similarity index 57%
rename from functions/install_header.sh
rename to lgsm/functions/install_header.sh
index e78987561..96c56a209 100644
--- a/functions/install_header.sh
+++ b/lgsm/functions/install_header.sh
@@ -1,14 +1,16 @@
#!/bin/bash
# LGSM install_header.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="190216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
clear
echo "================================="
echo "${gamename}"
echo "Linux Game Server Manager"
echo "by Daniel Gibbs"
-echo "http://gameservermanagers.com"
-echo "Contributors: http://gameservermanagers.com/contib"
+echo "Contributors: http://goo.gl/qLmitD"
+echo "https://gameservermanagers.com"
echo "================================="
diff --git a/functions/install_logs.sh b/lgsm/functions/install_logs.sh
similarity index 75%
rename from functions/install_logs.sh
rename to lgsm/functions/install_logs.sh
index 7d79fba6a..5ce29635e 100644
--- a/functions/install_logs.sh
+++ b/lgsm/functions/install_logs.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM install_logs.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
if [ "${checklogs}" != "1" ]; then
echo ""
@@ -20,24 +22,17 @@ if [ -n "${consolelogdir}" ]; then
fi
# If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs.
-if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]; then
+if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]||[ "${engine}" == "unreal" ]; then
if [ ! -h "${rootdir}/log/server" ]; then
ln -nfsv "${gamelogdir}" "${rootdir}/log/server"
fi
fi
# If a server is unreal2 or unity3d create a dir.
-if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]||[ "${gamename}" == "Teeworlds" ]; then
+if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]||[ "${gamename}" == "Teeworlds" ]||[ "${gamename}" == "seriousengine35" ]; then
mkdir -pv "${gamelogdir}"
fi
-# If a server is 7 Days to Die.
-if [ "${gamename}" == "7 Days To Die" ]; then
- if [ ! -h "${gamelogdir}/output_log.txt" ]; then
- ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
- fi
-fi
-
# If server uses SteamCMD create a symbolic link to the Steam logs.
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -h "${rootdir}/log/steamcmd" ]; then
@@ -45,3 +40,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then
fi
fi
sleep 1
+fn_scriptlog "logs installed"
\ No newline at end of file
diff --git a/functions/install_retry.sh b/lgsm/functions/install_retry.sh
similarity index 72%
rename from functions/install_retry.sh
rename to lgsm/functions/install_retry.sh
index 2e7697af5..80df1a6ba 100644
--- a/functions/install_retry.sh
+++ b/lgsm/functions/install_retry.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM install_retry.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
while true; do
read -e -i "y" -p "Retry install? [Y/n]" yn
diff --git a/functions/install_serverdir.sh b/lgsm/functions/install_server_dir.sh
similarity index 68%
rename from functions/install_serverdir.sh
rename to lgsm/functions/install_server_dir.sh
index 2c664e8e3..ccf629fc8 100644
--- a/functions/install_serverdir.sh
+++ b/lgsm/functions/install_server_dir.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM install_serverdir.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
echo ""
echo "Server Directory"
@@ -12,11 +14,11 @@ echo ""
pwd
echo ""
if [ -d "${filesdir}" ]; then
- fn_printwarningnl "A server is already installed here."
+ fn_print_warning_nl "A server is already installed here."
fi
if [ -z "${autoinstall}" ]; then
while true; do
- read -e -i "y" -p "Continue [y/N]" yn
+ read -e -i "y" -p "Continue [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh
new file mode 100644
index 000000000..ba25c57a6
--- /dev/null
+++ b/lgsm/functions/install_server_files.sh
@@ -0,0 +1,110 @@
+#!/bin/bash
+# LGSM install_server_files.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
+
+fn_install_server_files(){
+ if [ "${gamename}" == "Unreal Tournament 99" ]; then
+ fileurl="https://gameservermanagers.com/files/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
+ elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
+ fileurl="https://gameservermanagers.com/files/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut2004-server-3339-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
+ fi
+ fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+ fn_dl_extract "${filedir}" "${filename}" "${filesdir}"
+}
+
+fn_install_server_files_steamcmd(){
+ counter="0"
+ while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
+ counter=$((counter+1))
+ cd "${rootdir}/steamcmd"
+ if [ "${counter}" -le "10" ]; then
+ # Attempt 1-4: Standard attempt
+ # Attempt 5-6: Validate attempt
+ # Attempt 7-8: Validate, delete long name dir
+ # Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
+ # Attempt 11: Failure
+
+ if [ "${counter}" -ge "2" ]; then
+ fn_print_warning_nl "SteamCMD did not complete the download, retrying: Attempt ${counter}"
+ fn_scriptlog "SteamCMD did not complete the download, retrying: Attempt ${counter}"
+ fi
+
+ if [ "${counter}" -ge "7" ]; then
+ echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')"
+ find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
+ fi
+ if [ "${counter}" -ge "9" ]; then
+ rm -rf "${rootdir}/steamcmd"
+ check_steamcmd.sh
+ fi
+
+ # Detects if unbuffer command is available.
+ if [ $(command -v unbuffer) ]; then
+ unbuffer=unbuffer
+ fi
+
+ 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}" ${branch} +quit
+ local exitcode=$?
+ else
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit
+ local exitcode=$?
+ 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}" ${branch} -validate +quit
+ local exitcode=$?
+ else
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit
+ local exitcode=$?
+ fi
+ fi
+ elif [ "${counter}" -ge "11" ]; then
+ fn_print_failure_nl "SteamCMD did not complete the download, too many retrys"
+ fn_scriptlog "SteamCMD did not complete the download, too many retrys"
+ break
+ fi
+ done
+
+ # Goldsource servers commonly fail to download all the server files required.
+ # Validating a few of times may reduce the chance of this issue.
+ if [ "${engine}" == "goldsource" ]; then
+ fn_print_infomation_nl "Goldsource servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
+ 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
+ local exitcode=$?
+ done
+ fi
+}
+
+echo ""
+echo "Installing ${gamename} Server"
+echo "================================="
+sleep 1
+if [ -n "${appid}" ]; then
+ fn_install_server_files_steamcmd
+fi
+
+if [ -z "${appid}" ]||[ "${gamename}" == "GoldenEye: Source" ]; then
+ fn_install_server_files
+fi
+
+if [ -z "${autoinstall}" ]; then
+ echo ""
+ echo "================================="
+ while true; do
+ read -e -i "y" -p "Was the install successful? [Y/n]" yn
+ case $yn in
+ [Yy]* ) break;;
+ [Nn]* ) install_retry.sh;;
+ * ) echo "Please answer yes or no.";;
+ esac
+ done
+fi
\ No newline at end of file
diff --git a/functions/install_steamcmd.sh b/lgsm/functions/install_steamcmd.sh
similarity index 70%
rename from functions/install_steamcmd.sh
rename to lgsm/functions/install_steamcmd.sh
index 1f744e7f6..7c733d289 100644
--- a/functions/install_steamcmd.sh
+++ b/lgsm/functions/install_steamcmd.sh
@@ -1,11 +1,13 @@
#!/bin/bash
# LGSM install_steamcmd.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Downloads SteamCMD on install.
+local modulename="Install"
+
echo ""
echo "Installing SteamCMD"
echo "================================="
diff --git a/functions/install_ts3.sh b/lgsm/functions/install_ts3.sh
similarity index 85%
rename from functions/install_ts3.sh
rename to lgsm/functions/install_ts3.sh
index 71d27eec3..44d2b4231 100644
--- a/functions/install_ts3.sh
+++ b/lgsm/functions/install_ts3.sh
@@ -1,8 +1,10 @@
#!/bin/bash
# LGSM install_ts3.sh function
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
info_distro.sh
# Gets the teamspeak server architecture
@@ -11,7 +13,7 @@ if [ "${arch}" == "x86_64" ]; then
elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
ts3arch="x86"
else
- fn_printfailure "${arch} is an unsupported architecture"
+ fn_print_failure "${arch} is an unsupported architecture"
exit 1
fi
@@ -37,15 +39,16 @@ rm -f ".ts3_version_numbers_sorted.tmp"
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then
- fn_printfail "Checking for update: teamspeak.com"
- fn_scriptlog "Checking for update: teamspeak.com"
+ fn_print_fail "Checking for update: teamspeak.com"
sleep 1
- fn_printfail "Checking for update: teamspeak.com: Not returning version info"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
+ fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
sleep 2
exit 1
fi
+echo ""
+echo "Installing ${gamename} Server"
+echo "================================="
cd "${rootdir}"
echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq
diff --git a/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh
similarity index 91%
rename from functions/install_ts3db.sh
rename to lgsm/functions/install_ts3db.sh
index 57c87b97d..07b2dd539 100644
--- a/functions/install_ts3db.sh
+++ b/lgsm/functions/install_ts3db.sh
@@ -2,8 +2,10 @@
# LGSM fn_install_ts3_mariadb function
# Author: Daniel Gibbs
# Contributor: PhilPhonic
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
fn_install_ts3db_mariadb(){
echo ""
@@ -53,7 +55,7 @@ if [ -z "${autoinstall}" ]; then
esac
done
else
-fn_printwarningnl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install"
+fn_print_warning_nl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install"
fi
## Get privilege key
diff --git a/lgsm/functions/install_ut2k4_key.sh b/lgsm/functions/install_ut2k4_key.sh
new file mode 100644
index 000000000..af71c2993
--- /dev/null
+++ b/lgsm/functions/install_ut2k4_key.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# LGSM install_ut2k4_key.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+local modulename="Install"
+
+echo ""
+echo "Enter ${gamename} CD Key"
+echo "================================="
+sleep 1
+echo "To get your server listed on the Master Server list"
+echo "you must get a free CD key. Get a key here:"
+echo "https://forums.unrealtournament.com/utserver/cdkey.php?2004"
+echo ""
+if [ -z "${autoinstall}" ]; then
+ echo "Once you have the key enter it below"
+ echo -n "KEY: "
+ read CODE
+ echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
+ if [ -f "${systemdir}/cdkey" ]; then
+ fn_scriptlog "UT2K4 Server CD Key created"
+ fi
+else
+ echo "You can add your key using the following command"
+ echo "./${selfname} server-cd-key"
+fi
+echo ""
\ No newline at end of file
diff --git a/functions/logs.sh b/lgsm/functions/logs.sh
similarity index 81%
rename from functions/logs.sh
rename to lgsm/functions/logs.sh
index 68e3d0dcf..4ce5774f1 100644
--- a/functions/logs.sh
+++ b/lgsm/functions/logs.sh
@@ -2,8 +2,8 @@
# LGSM logs.sh function
# Author: Daniel Gibbs
# Contributor: UltimateByte
-# Website: http://gameservermanagers.com
-lgsm_version="230216"
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
# Description: Acts as a log rotater, removing old logs.
@@ -29,7 +29,7 @@ fi
# Log manager will start the cleanup if it finds logs older than "${logdays}"
if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
- fn_printdots "Starting"
+ fn_print_dots "Starting"
# Set addon logs directories
sourcemodlogdir="${systemdir}/addons/sourcemod/logs"
ulxlogdir="${systemdir}/data/ulx_logs"
@@ -38,28 +38,24 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
# Setting up counting variables
scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
sleep 1
- fn_printok "Starting"
+ fn_print_ok_nl "Starting"
fn_scriptlog "Starting"
- sleep 1
- echo -en "\n"
- fn_printinfo "Removing logs older than "${logdays}" days"
+ fn_print_info_nl "Removing logs older than "${logdays}" days"
fn_scriptlog "Removing logs older than "${logdays}" days"
- sleep 1
- echo -en "\n"
# Logging logfiles to be removed according to "${logdays}", counting and removing them
# Script logfiles
- find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${scriptlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${scriptlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
# SRCDS and unreal logfiles
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
- find "${gamelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Console logfiles
if [ -n "${consolelog}" ]; then
- find "${consolelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
@@ -67,7 +63,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
if [ "${engine}" == "source" ]; then
# SourceMod logfiles
if [ -d "${sourcemodlogdir}" ]; then
- find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
@@ -75,13 +71,13 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
if [ "${gamename}" == "Garry's Mod" ]; then
# ULX logfiles
if [ -d "${ulxlogdir}" ]; then
- find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# DarkRP logfiles
if [ -d "${darkrplogdir}" ]; then
- find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
@@ -89,7 +85,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
fi
# Legacy support
if [ -d "${legacyserverlogdir}" ]; then
- find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+ find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
# Remove folder if empty
@@ -101,8 +97,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
# Count total amount of files removed
count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
# Job done
- fn_printok "Removed ${count} log files"
+ fn_print_ok_nl "Removed ${count} log files"
fn_scriptlog "Removed ${count} log files"
- sleep 1
- echo -en "\n"
fi
diff --git a/lgsm/functions/monitor_gsquery.sh b/lgsm/functions/monitor_gsquery.sh
new file mode 100644
index 000000000..747b6dd45
--- /dev/null
+++ b/lgsm/functions/monitor_gsquery.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+# LGSM monitor_gsquery.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: uses gsquery.py to query the server port.
+# Detects if the server has frozen with the proccess still running.
+
+local modulename="Monitor"
+
+# Forces legecy servers to use gsquery as vat gsquery is not present in legecy
+if [ -z "${gsquery}" ]; then
+ gsquery="yes"
+fi
+
+if [ "${gsquery}" == "yes" ]; then
+
+ # Downloads gsquery.py if missing
+ if [ ! -f "${functionsdir}/gsquery.py" ]; then
+ fn_fetch_file_github "lgsm/functions" "gsquery.py" "${functionsdir}" "executecmd" "norun" "noforce" "nomd5"
+ fi
+
+ info_config.sh
+
+ if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
+ port=$((port + 1))
+ elif [ "${engine}" == "spark" ]; then
+ port=$((port + 1))
+ fi
+
+ if [ -z "${queryport}" ]; then
+ port="${queryport}"
+ fi
+
+ fn_print_info "Querying port: gsquery.py enabled"
+ fn_scriptlog "Querying port: gsquery.py enabled"
+ sleep 1
+
+ # Will query up to 4 times every 15 seconds.
+ # Servers changing map can return a failure.
+ # Will Wait up to 60 seconds to confirm server is down giving server time to change map.
+ totalseconds=0
+ for queryattempt in {1..5}; do
+ fn_print_dots "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
+ fn_print_querying_eol
+ fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : QUERYING"
+
+ gsquerycmd=$("${functionsdir}"/gsquery.py -a "${ip}" -p 1 -e "${engine}" 2>&1)
+ exitcode=$?
+
+ sleep 1
+ if [ "${exitcode}" == "0" ]; then
+ # Server OK
+ fn_print_ok "Querying port: ${ip}:${port} : ${queryattempt} : "
+ fn_print_ok_eol
+ fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : OK"
+ sleep 1
+ exit
+ else
+ # Server failed query
+ fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : ${gsquerycmd}"
+
+ if [ "${queryattempt}" == "5" ]; then
+ # Server failed query 4 times confirmed failure
+ fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
+ fn_print_fail_eol_nl
+ fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : FAIL"
+ sleep 1
+
+ # Send alert if enabled
+ alert="restartquery"
+ alert.sh
+ fn_restart
+ break
+ fi
+
+ # Seconds counter
+ for seconds in {1..15}; do
+ fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : \e[0;31m${gsquerycmd}\e[0m"
+ totalseconds=$((totalseconds + 1))
+ sleep 1
+ if [ "${seconds}" == "15" ]; then
+ break
+ fi
+ done
+ fi
+ done
+fi
\ No newline at end of file
diff --git a/lgsm/functions/update_check.sh b/lgsm/functions/update_check.sh
new file mode 100644
index 000000000..6647524d1
--- /dev/null
+++ b/lgsm/functions/update_check.sh
@@ -0,0 +1,342 @@
+#!/bin/bash
+# LGSM update_check.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Checks if a server update is available.
+
+local modulename="Update"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+### SteamCMD Update Checker ###
+
+fn_appmanifestinfo(){
+ appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf")
+ appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l)
+}
+
+fn_appmanifestcheck(){
+ fn_appmanifestinfo
+ # Multiple or no matching appmanifest files may sometimes be available.
+ # This is an error is corrected below if required.
+ if [ "${appmanifestfilewc}" -ge "2" ]; then
+ sleep 1
+ fn_print_warn "Multiple appmanifest_${appid}.acf files found"
+ fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
+ sleep 2
+ fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ sleep 1
+ for appfile in ${appmanifestfile}; do
+ rm "${appfile}"
+ done
+ appmanifestfilewc1="${appmanifestfilewc}"
+ fn_appmanifestinfo
+ if [ "${appmanifestfilewc}" -ge "2" ]; then
+ fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ sleep 1
+ echo ""
+ echo " Check user permissions"
+ for appfile in ${appmanifestfile}; do
+ echo " ${appfile}"
+ done
+ exit 1
+ else
+ sleep 1
+ fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
+ fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
+ sleep 1
+ fn_print_info_nl "Forcing update to correct issue"
+ fn_scriptlog "Forcing update to correct issue"
+ sleep 1
+ update_dl.sh
+ update_check.sh
+ fi
+ elif [ "${appmanifestfilewc}" -eq "0" ]; then
+ if [ "${forceupdate}" == "1" ]; then
+ fn_print_fail "Still no appmanifest_${appid}.acf found: Unable to update"
+ fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
+ exit 1
+ fi
+ forceupdate=1
+ fn_print_warn "No appmanifest_${appid}.acf found"
+ fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
+ sleep 2
+ fn_print_info_nl "Forcing update to correct issue"
+ fn_scriptlog "Forcing update to correct issue"
+ sleep 1
+ update_dl.sh
+ update_check.sh
+ fi
+}
+
+fn_logupdaterequest(){
+ # Checks for server update requests from server logs.
+ fn_print_dots "Checking for update: Server logs"
+ fn_scriptlog "Checking for update: Server logs"
+ sleep 1
+ requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
+ if [ "${requestrestart}" -ge "1" ]; then
+ fn_print_ok_nl "Checking for update: Server logs: Update requested"
+ sleep 1
+ echo ""
+ echo -ne "Applying update.\r"
+ sleep 1
+ echo -ne "Applying update..\r"
+ sleep 1
+ echo -ne "Applying update...\r"
+ sleep 1
+ echo -ne "\n"
+
+ unset updateonstart
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ else
+ update_dl.sh
+ fi
+ alert="update"
+ alert.sh
+ else
+ fn_print_ok "Checking for update: Server logs: No update requested"
+ sleep 1
+ fi
+}
+
+fn_steamcmdcheck(){
+ fn_appmanifestcheck
+ # Checks for server update from SteamCMD
+ fn_print_dots "Checking for update: SteamCMD"
+ fn_scriptlog "Checking for update: SteamCMD"
+ sleep 1
+
+ # Gets currentbuild
+ currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
+
+ # Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD
+
+ # Gets availablebuild info
+ cd "${rootdir}/steamcmd"
+ if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
+ rm -f "${HOME}/Steam/appcache/appinfo.vdf"
+ fi
+
+ # set branch for updateinfo
+ IFS=' ' read -a branchsplits <<< "${branch}"
+ if [ "${#branchsplits[@]}" -gt 1 ]; then
+ branchname="${branchsplits[1]}"
+ else
+ branchname="public"
+ fi
+
+ availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"${branchname}\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
+ if [ -z "${availablebuild}" ]; then
+ fn_print_fail "Checking for update: SteamCMD"
+ fn_scriptlog "Failure! Checking for update: SteamCMD"
+ sleep 1
+ fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info"
+ fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
+ exit 1
+ else
+ fn_print_ok "Checking for update: SteamCMD"
+ fn_scriptlog "Success! Checking for update: SteamCMD"
+ sleep 1
+ fi
+
+ if [ "${currentbuild}" != "${availablebuild}" ]; then
+ echo -e "\n"
+ echo -e "Update available:"
+ sleep 1
+ echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m"
+ echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e ""
+ echo -e " https://steamdb.info/app/${appid}/"
+ sleep 1
+ echo ""
+ echo -en "Applying update.\r"
+ sleep 1
+ echo -en "Applying update..\r"
+ sleep 1
+ echo -en "Applying update...\r"
+ sleep 1
+ echo -en "\n"
+ fn_scriptlog "Update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fn_scriptlog "${currentbuild} > ${availablebuild}"
+
+ unset updateonstart
+ info_status.sh
+ if [ "${status}" != "0" ]; then
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ else
+ update_dl.sh
+ fi
+ alert="update"
+ alert.sh
+ else
+ echo -e "\n"
+ echo -e "No update available:"
+ echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
+ echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e " https://steamdb.info/app/${appid}/"
+ echo -e ""
+ fn_print_ok_nl "No update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fi
+}
+
+### END SteamCMD Update Checker ###
+
+fn_teamspeak3_check(){
+ # Checks for server update from teamspeak.com using a mirror dl.4players.de
+ fn_print_dots "Checking for update: teamspeak.com"
+ fn_scriptlog "Checking for update: teamspeak.com"
+ sleep 1
+
+ # Gets currentbuild info
+ # Checks currentbuild info is available, if fails a server restart will be forced to generate logs
+ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
+ fn_print_fail "Checking for update: teamspeak.com"
+ sleep 1
+ fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
+ sleep 2
+ fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart"
+ fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
+ sleep 2
+ command_stop.sh
+ command_start.sh
+ sleep 2
+ # If still failing will exit
+ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
+ fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
+ exit 1
+ fi
+ fi
+ currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
+
+ # Gets the teamspeak server architecture
+ info_distro.sh
+ if [ "${arch}" == "x86_64" ]; then
+ ts3arch="amd64"
+ elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
+ ts3arch="x86"
+ else
+ echo ""
+ fn_print_failure "${arch} is an unsupported architecture"
+ exit 1
+ fi
+
+ # Gets availablebuild info
+
+ # Grabs all version numbers but not in correct order
+ wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp
+
+ # Sort version numbers
+ cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp
+
+ # Finds directory with most recent server version.
+ while read ts3_version_number; do
+ wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
+ if [ $? -eq 0 ]; then
+ availablebuild="${ts3_version_number}"
+ # Break while-loop, if the latest release could be found
+ break
+ fi
+ done < .ts3_version_numbers_sorted.tmp
+
+ # Tidy up
+ rm -f ".ts3_version_numbers_unsorted.tmp"
+ rm -f ".ts3_version_numbers_sorted.tmp"
+
+ # Checks availablebuild info is available
+ if [ -z "${availablebuild}" ]; then
+ fn_print_fail "Checking for update: teamspeak.com"
+ fn_scriptlog "Checking for update: teamspeak.com"
+ sleep 1
+ fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
+ sleep 2
+ exit 1
+ else
+ fn_print_ok "Checking for update: teamspeak.com"
+ fn_scriptlog "Success! Checking for update: teamspeak.com"
+ sleep 1
+ fi
+
+ # Removes dots so if can compare version numbers
+ currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
+ if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
+ echo -e "\n"
+ echo -e "Update available:"
+ sleep 1
+ echo -e " Current build: \e[0;31m${currentbuild} ${architecture}\e[0;39m"
+ echo -e " Available build: \e[0;32m${availablebuild} ${architecture}\e[0;39m"
+ echo -e ""
+ sleep 1
+ echo ""
+ echo -en "Applying update.\r"
+ sleep 1
+ echo -en "Applying update..\r"
+ sleep 1
+ echo -en "Applying update...\r"
+ sleep 1
+ echo -en "\n"
+ fn_scriptlog "Update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fn_scriptlog "${currentbuild} > ${availablebuild}"
+
+ unset updateonstart
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ update_dl.sh
+ command_start.sh
+ sleep 5
+ command_stop.sh
+ else
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ fi
+ alert="update"
+ alert.sh
+ else
+ echo -e "\n"
+ echo -e "No update available:"
+ echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
+ echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e ""
+ fn_print_ok_nl "No update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fi
+}
+
+check.sh
+fn_print_dots "Checking for update"
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_teamspeak3_check
+elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then
+ # Goldsource servers bypass checks as fn_steamcmdcheck does not work for appid 90 servers.
+ # forceupdate bypasses checks
+ if [ "${status}" != "0" ]; then
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ else
+ update_dl.sh
+ fi
+else
+ fn_logupdaterequest
+ fn_steamcmdcheck
+fi
diff --git a/lgsm/functions/update_dl.sh b/lgsm/functions/update_dl.sh
new file mode 100644
index 000000000..ee1cc361c
--- /dev/null
+++ b/lgsm/functions/update_dl.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# LGSM update_dl.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+lgsm_version="210516"
+
+# Description: Runs a server update.
+
+local modulename="Update"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+fn_steamcmd_dl(){
+ cd "${rootdir}"
+ cd "steamcmd"
+
+ # Detects if unbuffer command is available.
+ if [ $(command -v unbuffer) ]; then
+ unbuffer=unbuffer
+ fi
+
+ 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 -a "${scriptlog}"
+ else
+ ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit | tee -a "${scriptlog}"
+ fi
+
+ fix.sh
+}
+
+fn_teamspeak3_dl(){
+ cd "${rootdir}"
+ echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
+ fn_scriptlog "Downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
+ wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq
+ sleep 1
+ echo -e "extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
+ fn_scriptlog "Extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
+ tar -xf "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" 2> "${scriptlogdir}/.${servicename}-tar-error.tmp"
+ local status=$?
+ if [ ${status} -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL - Exit status ${status}"
+ fn_scriptlog "Failed to extract - Exit status ${status}"
+ sleep 1
+ cat "${scriptlogdir}/.${servicename}-tar-error.tmp"
+ cat "${scriptlogdir}/.${servicename}-tar-error.tmp" >> "${scriptlog}"
+ rm "${scriptlogdir}/.${servicename}-tar-error.tmp"
+ fn_scriptlog "Failure! Unable to update"
+ exit ${status}
+ fi
+ echo -e "copying to ${filesdir}...\c"
+ fn_scriptlog "Copying to ${filesdir}"
+ cp -R "${rootdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp"
+ local status=$?
+ if [ ${status} -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL - Exit status ${status}"
+ fn_scriptlog "Failed to copy - Exit status ${status}"
+ sleep 1
+ cat "${scriptlogdir}/.${servicename}-cp-error.tmp"
+ cat "${scriptlogdir}/.${servicename}-cp-error.tmp" >> "${scriptlog}"
+ rm "${scriptlogdir}/.${servicename}-cp-error.tmp"
+ fn_scriptlog "Failure! Unable to update"
+ exit ${status}
+ fi
+ rm -f teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2
+ rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}"
+}
+
+check.sh
+info_config.sh
+fn_print_dots "Updating ${servername}"
+sleep 1
+fn_print_ok_nl "Updating ${servername}"
+fn_scriptlog "Updating ${servername}"
+sleep 1
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ fn_teamspeak3_dl
+else
+ fn_steamcmd_dl
+fi
diff --git a/lgsm/lib/ubuntu12.04/i386/libc.so.6 b/lgsm/lib/ubuntu12.04/i386/libc.so.6
new file mode 100644
index 000000000..916329be7
Binary files /dev/null and b/lgsm/lib/ubuntu12.04/i386/libc.so.6 differ
diff --git a/lgsm/lib/ubuntu12.04/i386/libm.so.6 b/lgsm/lib/ubuntu12.04/i386/libm.so.6
new file mode 100644
index 000000000..23c73207a
Binary files /dev/null and b/lgsm/lib/ubuntu12.04/i386/libm.so.6 differ
diff --git a/lgsm/lib/ubuntu12.04/i386/libstdc++.so.6 b/lgsm/lib/ubuntu12.04/i386/libstdc++.so.6
new file mode 100644
index 000000000..614f0ec23
Binary files /dev/null and b/lgsm/lib/ubuntu12.04/i386/libstdc++.so.6 differ
diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh
index 61b326506..eac77ae7c 100644
--- a/tests/tests_jc2server.sh
+++ b/tests/tests_jc2server.sh
@@ -2,15 +2,15 @@
# TravisCI Tests
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
version="271215"
#### Variables ####
-# Notification Email
+# Alert Email
# (on|off)
-emailnotification="on"
-email="me@danielgibbs.co.uk"
+emailalert="off"
+email=""
# Steam login
steamuser="anonymous"
@@ -175,7 +175,7 @@ echo "================================="
echo "TravisCI Tests"
echo "Linux Game Server Manager"
echo "by Daniel Gibbs"
-echo "http://gameservermanagers.com"
+echo "https://gameservermanagers.com"
echo "================================="
echo ""
sleep 1
@@ -325,7 +325,7 @@ echo "Description:"
echo "change the buildid tricking SteamCMD to update."
requiredstatus="OFFLINE"
fn_setstatus
-fn_printinfonl "changed buildid to 0."
+fn_print_info_nl "changed buildid to 0."
sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
update_check.sh
echo ""
@@ -338,7 +338,7 @@ echo "Description:"
echo "change the buildid tricking SteamCMD to update server while already running."
requiredstatus="ONLINE"
fn_setstatus
-fn_printinfonl "changed buildid to 0."
+fn_print_info_nl "changed buildid to 0."
sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
update_check.sh
echo ""
@@ -351,7 +351,7 @@ echo "Description:"
echo "removing appmanifest file will cause script to repair."
requiredstatus="OFFLINE"
fn_setstatus
-fn_printinfonl "removed appmanifest_${appid}.acf."
+fn_print_info_nl "removed appmanifest_${appid}.acf."
rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf"
update_check.sh
echo ""
@@ -433,7 +433,7 @@ echo "Description:"
echo "run monitor while server is offline with no lockfile."
requiredstatus="OFFLINE"
fn_setstatus
-fn_printinfonl "creating lockfile."
+fn_print_info_nl "creating lockfile."
date > "${rootdir}/${lockselfname}"
(command_monitor.sh)
echo ""
@@ -449,7 +449,7 @@ fn_setstatus
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
(command_monitor.sh)
echo ""
-fn_printinfonl "Reseting ${servercfg}."
+fn_print_info_nl "Reseting ${servercfg}."
install_config.sh
echo ""
echo "Test complete!"
@@ -478,7 +478,7 @@ echo ""
requiredstatus="OFFLINE"
fn_setstatus
sleep 1
-fn_printinfo "Tidying up directories."
+fn_print_info "Tidying up directories."
sleep 1
rm -rfv ${serverfiles}
echo "END"
diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh
index b3207c368..e9604c7d9 100644
--- a/tests/tests_ts3server.sh
+++ b/tests/tests_ts3server.sh
@@ -2,15 +2,15 @@
# TravisCI Tests
# Server Management Script
# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
+# Website: https://gameservermanagers.com
version="071115"
#### Variables ####
-# Notification Email
+# Alert Email
# (on|off)
-emailnotification="on"
-email="me@danielgibbs.co.uk"
+emailalert="off"
+email=""
# Start Variables
updateonstart="off"
@@ -109,22 +109,21 @@ fn_runfunction
core_functions.sh
fn_currentstatus_tmux(){
-pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
-if [ "${pid}" != "0" ]; then
- currentstatus="ONLINE"
-else
- currentstatus="OFFLINE"
-fi
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ currentstatus="ONLINE"
+ else
+ currentstatus="OFFLINE"
+ fi
}
fn_currentstatus_ts3(){
-ts3status=$(${executable} status servercfgfullpathfile=${servercfgfullpath})
-
-if [ "${ts3status}" == "Server is running" ]; then
- currentstatus="ONLINE"
-else
- currentstatus="OFFLINE"
-fi
+check_status.sh
+ if [ "${status}" != "0" ]; then
+ currentstatus="ONLINE"
+ else
+ currentstatus="OFFLINE"
+ fi
}
fn_setstatus(){
@@ -162,7 +161,7 @@ echo "================================="
echo "TravisCI Tests"
echo "Linux Game Server Manager"
echo "by Daniel Gibbs"
-echo "http://gameservermanagers.com"
+echo "https://gameservermanagers.com"
echo "================================="
echo ""
sleep 1
@@ -345,7 +344,7 @@ echo "Description:"
echo "run monitor while server is offline with no lockfile."
requiredstatus="OFFLINE"
fn_setstatus
-fn_printinfonl "creating lockfile."
+fn_print_info_nl "creating lockfile."
date > "${rootdir}/${lockselfname}"
(command_monitor.sh)
echo ""
@@ -361,7 +360,7 @@ fn_setstatus
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
(command_monitor.sh)
echo ""
-fn_printinfonl "Reseting ${servercfg}."
+fn_print_info_nl "Reseting ${servercfg}."
install_config.sh
echo ""
echo "Test complete!"
@@ -390,7 +389,7 @@ echo ""
requiredstatus="OFFLINE"
fn_setstatus
sleep 1
-fn_printinfo "Tidying up directories."
+fn_print_info "Tidying up directories."
sleep 1
rm -rfv ${serverfiles}
echo "END"
\ No newline at end of file