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_

-linux Game Server Managers +linux Game Server Managers [![Build Status](https://travis-ci.org/dgibbs64/linuxgsm.svg?branch=master)](https://travis-ci.org/dgibbs64/linuxgsm) [![Under Development](https://badge.waffle.io/dgibbs64/linuxgsm.svg?label=Under%20Development&title=Under%20Development)](http://waffle.io/dgibbs64/linuxgsm) -The Linux Game Server Managers are command line tools for quick, simple deployment and management of various dedicated game servers and voice comms servers. +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