From 1995717d94967adbf979993afd8f9a79c59ac93f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 26 Jan 2015 15:51:42 +0000 Subject: [PATCH] Deleted functions with old names Removed the old functions that are no longer required. This may cause issues with older script version. If you experience and issue please update --- functions/fn_autoip | 28 ---- functions/fn_backupserver | 61 -------- functions/fn_debugserver | 59 -------- functions/fn_distro | 18 --- functions/fn_distrodetails | 90 ------------ functions/fn_emailnotification | 43 ------ functions/fn_emailtest | 21 --- functions/fn_getquery | 28 ---- functions/fn_glibcfix | 116 --------------- functions/fn_header | 18 --- functions/fn_installcomplete | 12 -- functions/fn_kffix | 27 ---- functions/fn_load | 8 - functions/fn_loginstall | 42 ------ functions/fn_logmanager | 50 ------- functions/fn_monitorserver | 59 -------- functions/fn_retryinstall | 14 -- functions/fn_rofix | 27 ---- functions/fn_rootcheck | 10 -- functions/fn_serverconfig | 242 ------------------------------- functions/fn_serverdirectory | 23 --- functions/fn_servername | 23 --- functions/fn_serverquery | 84 ----------- functions/fn_startserver | 68 --------- functions/fn_steamdl | 51 ------- functions/fn_steamfix | 40 ----- functions/fn_steaminstall | 72 --------- functions/fn_stopserver | 28 ---- functions/fn_syscheck | 10 -- functions/fn_tmuxcheck | 17 --- functions/fn_unreal2compressmaps | 33 ----- functions/fn_updateserver | 20 --- functions/fn_uptime | 12 -- functions/fn_ut2k4filesdl | 54 ------- functions/fn_ut2k4fix | 27 ---- functions/fn_ut2k4install | 42 ------ functions/fn_ut2k4key | 18 --- functions/fn_ut99compressmaps | 33 ----- functions/fn_ut99filesdl | 54 ------- functions/fn_ut99fix | 24 --- functions/fn_ut99install | 42 ------ functions/fn_validateserver | 26 ---- functions/fn_versioncheck | 189 ------------------------ 43 files changed, 1963 deletions(-) delete mode 100644 functions/fn_autoip delete mode 100644 functions/fn_backupserver delete mode 100644 functions/fn_debugserver delete mode 100644 functions/fn_distro delete mode 100644 functions/fn_distrodetails delete mode 100644 functions/fn_emailnotification delete mode 100644 functions/fn_emailtest delete mode 100644 functions/fn_getquery delete mode 100644 functions/fn_glibcfix delete mode 100644 functions/fn_header delete mode 100644 functions/fn_installcomplete delete mode 100644 functions/fn_kffix delete mode 100644 functions/fn_load delete mode 100644 functions/fn_loginstall delete mode 100644 functions/fn_logmanager delete mode 100644 functions/fn_monitorserver delete mode 100644 functions/fn_retryinstall delete mode 100644 functions/fn_rofix delete mode 100644 functions/fn_rootcheck delete mode 100644 functions/fn_serverconfig delete mode 100644 functions/fn_serverdirectory delete mode 100644 functions/fn_servername delete mode 100644 functions/fn_serverquery delete mode 100644 functions/fn_startserver delete mode 100644 functions/fn_steamdl delete mode 100644 functions/fn_steamfix delete mode 100644 functions/fn_steaminstall delete mode 100644 functions/fn_stopserver delete mode 100644 functions/fn_syscheck delete mode 100644 functions/fn_tmuxcheck delete mode 100644 functions/fn_unreal2compressmaps delete mode 100644 functions/fn_updateserver delete mode 100644 functions/fn_uptime delete mode 100644 functions/fn_ut2k4filesdl delete mode 100644 functions/fn_ut2k4fix delete mode 100644 functions/fn_ut2k4install delete mode 100644 functions/fn_ut2k4key delete mode 100644 functions/fn_ut99compressmaps delete mode 100644 functions/fn_ut99filesdl delete mode 100644 functions/fn_ut99fix delete mode 100644 functions/fn_ut99install delete mode 100644 functions/fn_validateserver delete mode 100644 functions/fn_versioncheck diff --git a/functions/fn_autoip b/functions/fn_autoip deleted file mode 100644 index 6f38ec317..000000000 --- a/functions/fn_autoip +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# LGSM fn_autoip function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Identifies the server interface IP. -# If multiple interfaces this will need to be set manually. - -if [ ! -f /bin/ip ]; then - ipcommand="/sbin/ip" -else - ipcommand="ip" -fi -getip=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0) -getipwc=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0) - -if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then - if [ "${getipwc}" -ge "2" ]; then - fn_printwarn "Multiple active network interfaces found.\n\n" - echo -en "Manually specify the IP you want to use within the ${selfname} script.\n" - echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" - echo -en "${getip}\n" - exit - else - ip=${getip} - fi -fi \ No newline at end of file diff --git a/functions/fn_backupserver b/functions/fn_backupserver deleted file mode 100644 index ecfb76ab6..000000000 --- a/functions/fn_backupserver +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# LGSM fn_backupserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Creates a .tar.gz file in the backup directory. - -local modulename="Backup" -fn_rootcheck -fn_syscheck -backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')" -echo "" -echo "${gamename} Backup" -echo "============================" -echo "" -echo "The following backup will be created:" -echo "" -echo "${backupdir}/${backupname}.tar.gz" -echo "" -while true; do - read -p "Continue? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; return 1;; - * ) echo "Please answer yes or no.";; -esac -done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") -if [ "${tmuxwc}" -eq 1 ]; then - echo "" - fn_printwarningnl "${servicename} is currently running." - sleep 1 - while true; do - read -p "Stop ${servicename} while running the backup? [y/N]" yn - case $yn in - [Yy]* ) fn_stopserver; break;; - [Nn]* ) break;; - * ) echo "Please answer yes or no.";; - esac - done -fi -fn_scriptlog "Started" -echo -en "starting backup.\r" -sleep 1 -echo -en "starting backup..\r" -sleep 1 -echo -en "starting backup...\r" -sleep 1 -echo -en "\n" -cd "${rootdir}" -mkdir -pv "${backupdir}" > /dev/null 2>&1 -tar -cvzf "${backupdir}/${backupname}.tar.gz" --exclude "${backupdir}" ./* -echo "" -echo "Backup created: ${backupdir}/${backupname}.tar.gz" -fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz" -sleep 1 -echo "" -fn_printcompletenl "Complete." -fn_scriptlog "Complete" -echo "" \ No newline at end of file diff --git a/functions/fn_debugserver b/functions/fn_debugserver deleted file mode 100644 index 1baba750a..000000000 --- a/functions/fn_debugserver +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# LGSM fn_debugserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 140115 - -# Description: Runs the server without tmux. Runs direct from the terminal. - -local modulename="Debug" -fn_rootcheck -fn_syscheck -fn_autoip -fn_distrodetails -fn_parms -echo "" -echo "${gamename} Debug" -echo "============================" -echo "" -echo -e "Distro: ${os}" -echo -e "Arch: ${arch}" -echo -e "Kernel: ${kernel}" -echo -e "Hostname: $HOSTNAME" -echo "" -echo "Start parameters:" -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then - echo "${executable} ${parms} -debug" -else - echo "${executable} ${parms}" -fi -echo "" -echo -e "Use for identifying server issues only!" -echo -e "Press CTRL+c to drop out of debug mode." -fn_printwarningnl "If ${servicename} is already running it will be stopped." -echo "" -while true; do - read -p "Continue? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; return 1;; - * ) echo "Please answer yes or no.";; -esac -done -fn_scriptlog "Starting debug" -fn_printinfonl "Stopping any running servers" -fn_scriptlog "Stopping any running servers" -sleep 1 -fn_stopserver -fn_printdots "Starting debug" -sleep 1 -fn_printok "Starting debug" -fn_scriptlog "Started debug" -sleep 1 -echo -en "\n" -cd "${executabledir}" -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then - ${executable} ${parms} -debug -else - ${executable} ${parms} -fi \ No newline at end of file diff --git a/functions/fn_distro b/functions/fn_distro deleted file mode 100644 index 0e557e2dd..000000000 --- a/functions/fn_distro +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# LGSM fn_distro function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 141214 -# Depricated: fn_distrodetails has replaced this function. - -arch=$(uname -m) -kernel=$(uname -r) -if [ -f /etc/lsb-release ]; then - os=$(lsb_release -s -d) -elif [ -f /etc/debian_version ]; then - os="Debian $(cat /etc/debian_version)" -elif [ -f /etc/redhat-release ]; then - os=$(cat /etc/redhat-release) -else - os="$(uname -s) $(uname -r)" -fi \ No newline at end of file diff --git a/functions/fn_distrodetails b/functions/fn_distrodetails deleted file mode 100644 index d1c90a5f4..000000000 --- a/functions/fn_distrodetails +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# LGSM fn_distrodetails function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 141214 - -# Description: Variables providing useful info on the Operating System such as disk and performace info. -# Used for fn_details, fn_debugserver and fn_emailnotification. - -## Distro infomation -# Returns architecture, kernel and distro/os. -arch=$(uname -m) -kernel=$(uname -r) -if [ -f /etc/lsb-release ]; then - os=$(lsb_release -s -d) -elif [ -f /etc/debian_version ]; then - os="Debian $(cat /etc/debian_version)" -elif [ -f /etc/redhat-release ]; then - os=$(cat /etc/redhat-release) -else - os="$(uname -s) $(uname -r)" -fi - -# Glibc version number -# e.g: 1.17 -glibcv=$(ldd --version |grep ldd|awk '{print $NF}') - -# tmux version -# e.g: tmux 1.6 -if [ -z $(command -v tmux) ]; then - tmuxv="\e[0;31mNOT INSTALLED!\e[0m" -elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then - tmuxv="$(tmux -V) (>= 1.6 required for console log)" -else - tmuxv=$(tmux -V) -fi - -## Performance - -# Average server load -load=$(uptime|awk -F 'load average: ' '{ print $2 }') - -# Memory - -# Older versions of free do not support -h option. -if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then - option="-m" -else - option="-h" -fi -physmemtotal=$(free ${option} | awk '/Mem:/ {print $2}') -physmemused=$(free ${option} | awk '/Mem:/ {print $3}') -physmemfree=$(free ${option} | awk '/Mem:/ {print $4}') -swaptotal=$(free ${option} | | awk '/Swap:/ {print $2}') -swapused=$(free ${option} | awk '/Swap:/ {print $3}') -swapfree=$(free ${option} | awk '/Swap:/ {print $4}') - -# Uptime -uptime=$( /dev/null 2>&1 -tail -25 "${scriptlog}" >> "${emaillog}" -if [ ! -z "${consolelog}" ]; then - echo -e "\n\nConsole log\n====================\n" >> "${emaillog}" - tail -25 "${consolelog}" >> "${emaillog}" -fi -if [ ! -z "${gamelogdir}" ]; then - echo -e "\n\nServer log\n====================\n" >> "${emaillog}" - tail "${gamelogdir}"/*|grep -v "==>"|sed '/^$/d'|tail -25 >> "${emaillog}" -fi -mail -s "${subject}" ${email} < "${emaillog}" -fn_printok "Sending notification to ${email}" -fn_scriptlog "Sent notification to ${email}" -sleep 1 -echo -en "\n" \ No newline at end of file diff --git a/functions/fn_emailtest b/functions/fn_emailtest deleted file mode 100644 index 4436f5161..000000000 --- a/functions/fn_emailtest +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# LGSM fn_emailtest function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Sends a test email notification. - -local modulename="Email" -fn_rootcheck -fn_syscheck -if [ "${emailnotification}" = "on" ]; then - fn_scriptlog "Sending test notification" - subject="${servicename} Email Test Notification - Testing ${servername}" - failurereason="Testing ${servicename} email notification" - actiontaken="Sent test email...hello is this thing on?" - fn_emailnotification -else - fn_printfailnl "Notifications not enabled" - fn_scriptlog "Notifications not enabled" -fi \ No newline at end of file diff --git a/functions/fn_getquery b/functions/fn_getquery deleted file mode 100644 index 599b8d7f1..000000000 --- a/functions/fn_getquery +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# LGSM fn_getquery function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -fn_dlgsquery(){ -cd "${rootdir}" -echo -e "downloading gsquery.py...\c" -wget -N --no-check-certificate /dev/null "http://danielgibbs.co.uk/dl/gsquery.py" 2>&1 | grep -F "HTTP" | grep -v "Moved Permanently" | cut -c45- | uniq -chmod +x gsquery.py -} - -echo "" -echo "GameServerQuery" -echo "============================" -if [ -z ${autoinstall} ]; then - while true; do - read -p "Do you want to install GameServerQuery? [y/N]" yn - case $yn in - [Yy]* ) fn_dlgsquery;break;; - [Nn]* ) echo ""; echo "Not installing GameServerQuery.";break;; - * ) echo "Please answer yes or no.";; - esac - done -else - fn_dlgsquery -fi \ No newline at end of file diff --git a/functions/fn_glibcfix b/functions/fn_glibcfix deleted file mode 100644 index 2bae92199..000000000 --- a/functions/fn_glibcfix +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# LGSM fn_glibcfix function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 1501214 - -fn_glibcfixmsg(){ -echo "" -echo "GLIBC Fix required" -echo "============================" -sleep 1 -fn_printwarningnl "${gamename} requires GLIBC_${glibcversion} or above" -sleep 1 -echo "" -echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m" -echo -e "Required: =>\e[0;32m GLIBC_${glibcversion}\e[0;39m" -echo "" -sleep 1 -echo "The installer will now detect and download the required files to allow ${gamename} server to run on a distro with less than GLIBC_${glibcversion}." -echo "note: This will NOT upgrade GLIBC on your system." -sleep 1 -echo "" -echo -en "loading required files.\r" -sleep 1 -echo -en "loading required files..\r" -sleep 1 -echo -en "loading required files...\r" -sleep 1 -echo -en "\n" -} - -# if ldd command not detected -if [ -z $(command -v ldd) ]; then - echo "" - fn_printfailurenl "GLIBC is not detected" - sleep 1 - echo "Install GLIBC and retry installation." - sleep 1 - echo "" - while true; do - read -p "Continue install? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; exit;; - * ) echo "Please answer yes or no.";; - esac - done -# if Glibc less than 1.15 -elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 215 ]; then - # Blade Symphony - if [ "${gamename}" == "Blade Symphony" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # Fistful of Frags - elif [ "${gamename}" == "Fistful of Frags" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cd "${filesdir}" - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/FistfulOfFrags/dependencies/libm.so.6 - # Garrys's Mod - elif [ "${gamename}" == "Garrys's Mod" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cd "${filesdir}/bin" - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libc.so.6 - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libm.so.6 - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libpthread.so.0 - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # Insurgency - elif [ "${gamename}" == "Insurgency" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cd "${filesdir}/bin" - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libc.so.6 - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/librt.so.1 - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libpthread.so.0 - # Natural Selection 2 - elif [ "${gamename}" == "Natural Selection 2" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cd "${filesdir}" - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NaturalSelection2/dependencies/libm.so.6 - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # No More Room in Hell - elif [ "${gamename}" == "No More Room in Hell" ]; then - glibcversion="2.15" - fn_glibcfixmsg - cd "${filesdir}" - wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NoMoreRoomInHell/dependencies/libm.so.6 - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # if Glibc less than 1.13 - elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 213 ]; then - # ARMA 3 - if [ "${gamename}" == "ARMA 3" ]; then - glibcversion="2.13" - fn_glibcfixmsg - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # Just Cause 2 - elif [ "${gamename}" == "Just Cause 2" ]; then - glibcversion="2.13" - fn_glibcfixmsg - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6" - # Serious Sam 3: BFE - elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then - glibcversion="2.13" - fn_glibcfixmsg - cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/Bin/libstdc++.so.6" - else - fn_printfailurenl "Unable to detect game. Fix not applied" - fi - else - fn_printfailurenl "Unable to detect game. Fix not applied" - fi -fi -sleep 1 \ No newline at end of file diff --git a/functions/fn_header b/functions/fn_header deleted file mode 100644 index d7caaed0d..000000000 --- a/functions/fn_header +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# LGSM fn_header function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -clear -echo "=================================" -echo "${gamename}" -echo "Linux Game Server Manager" -echo "by Daniel Gibbs" -if [ "${gamename}" == "ARMA 3" ]; then - echo "contributions by Scarsz" -elif [ "${gamename}" == "Left 4 Dead" ]; then - echo "contributions by Summit Singh Thakur" -fi -echo "http://danielgibbs.co.uk" -echo "=================================" \ No newline at end of file diff --git a/functions/fn_installcomplete b/functions/fn_installcomplete deleted file mode 100644 index 3dd6498e1..000000000 --- a/functions/fn_installcomplete +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# LGSM fn_installcomplete function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -echo "=================================" -echo "Install Complete!" -echo "" -echo "To start server type:" -echo "${selfname} start" -echo "" \ No newline at end of file diff --git a/functions/fn_kffix b/functions/fn_kffix deleted file mode 100644 index 3b04d2a1e..000000000 --- a/functions/fn_kffix +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# LGSM fn_kffix function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -echo "Applying ${gamename} Server Fixes" -echo "=================================" -echo "Applying WebAdmin ROOst.css fix." -echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" -sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" -sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" -sleep 1 -echo "Applying WebAdmin CharSet fix." -echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" -sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int" -sleep 1 -echo "applying server name fix." -sleep 1 -echo "forcing server restart..." -sleep 1 -cd "${rootdir}" -${selfname} start -sleep 5 -${selfname} restart -sleep 5 -${selfname} stop \ No newline at end of file diff --git a/functions/fn_load b/functions/fn_load deleted file mode 100644 index c8745766d..000000000 --- a/functions/fn_load +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# LGSM fn_load function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 141214 -# Depricated: fn_distrodetails has replaced this function. - -load=$(uptime|awk -F 'load average' '{ print $2 }') \ No newline at end of file diff --git a/functions/fn_loginstall b/functions/fn_loginstall deleted file mode 100644 index dc6fb8654..000000000 --- a/functions/fn_loginstall +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# LGSM fn_loginstall function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 040115 - -echo "" -echo "Creating log directorys" -echo "=================================" -sleep 1 -# Create dir's for the script and console logs -mkdir -v "${rootdir}/log" -mkdir -v "${scriptlogdir}" -touch "${scriptlog}" -mkdir -v "${consolelogdir}" -touch "${consolelog}" -# If a server is source or goldsource create a symbolic link to the game server logs -if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then - if [ ! -h "${rootdir}/log/server" ]; then - ln -nfsv "${gamelogdir}" "${rootdir}/log/server" - else - echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" - fi -fi -# If a server is unreal2 or unity3d create a dir -if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then - mkdir -pv "${gamelogdir}" -fi -if [ "${gamename}" == "7 Days To Die" ]; then - if [ ! -h "${gamelogdir}/output_log.txt" ]; then - ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" - fi -fi -# If server uses SteamCMD create a symbolic link to the Steam logs -if [ -d "${rootdir}/Steam/logs" ]; then - if [ ! -h "${rootdir}/log/steamcmd" ]; then - ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" - else - echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" - fi -fi -sleep 1 diff --git a/functions/fn_logmanager b/functions/fn_logmanager deleted file mode 100644 index 29c1c34ae..000000000 --- a/functions/fn_logmanager +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# LGSM fn_logmanager function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Acts as a log rotater, removing old logs. - -local modulename="Log Manager" -if [ ! -e "${consolelog}" ]; then - touch "${consolelog}" -fi -# log manager will active if finds logs older than ${logdays} -if [ $(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l) -ne "0" ]; then - fn_printdots "Starting" - sleep 1 - fn_printok "Starting" - fn_scriptlog "Starting" - sleep 1 - echo -en "\n" - fn_printinfo "Removing logs older than ${logdays} days" - fn_scriptlog "Removing logs older than ${logdays} days" - sleep 1 - echo -en "\n" - if [ "${engine}" == "unreal2" ]; then - find "${gamelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}" - fi - find "${scriptlogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}" - find "${consolelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}" - if [ "${engine}" == "unreal2" ]; then - gamecount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l) - fi - scriptcount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l) - consolecount=$(find "${consolelogdir}"/* -mtime +${logdays}|wc -l) - count=$((${scriptcount} + ${consolecount})) - if [ "${engine}" == "unreal2" ]; then - count=$((${scriptcount} + ${consolecount} + ${gamecount})) - else - count=$((${scriptcount} + ${consolecount})) - fi - if [ "${engine}" == "unreal2" ]; then - find "${gamelogdir}"/* -mtime +${logdays} -exec rm {} \; - fi - find "${scriptlogdir}"/* -mtime +${logdays} -exec rm {} \; - find "${consolelogdir}"/* -mtime +${logdays} -exec rm {} \; - fn_printok "Removed ${count} log files" - fn_scriptlog "Removed ${count} log files" - sleep 1 - echo -en "\n" -fi \ No newline at end of file diff --git a/functions/fn_monitorserver b/functions/fn_monitorserver deleted file mode 100644 index 380ec5daf..000000000 --- a/functions/fn_monitorserver +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# LGSM fn_monitorserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Monitors server by checking for running proccesses -# then passes to fn_serverquery. - -local modulename="Monitor" -fn_rootcheck -fn_syscheck -fn_autoip -fn_printdots "${servername}" -fn_scriptlog "${servername}" -sleep 1 -if [ ! -f "${lockselfname}" ]; then - fn_printinfo "Disabled: No lock file found" - fn_scriptlog "Disabled: No lock file found" - sleep 1 - echo -en "\n" - echo "To enable monitor run ${selfname} start" - exit -fi -updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l) -if [ "${updatecheck}" = "0" ]; then - fn_printdots "Checking session: CHECKING" - fn_scriptlog "Checking session: CHECKING" - sleep 1 - tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l) - if [ "${tmuxwc}" -eq 1 ]; then - fn_printok "Checking session: OK" - fn_scriptlog "Checking session: OK" - sleep 1 - echo -en "\n" - fn_serverquery - exit - else - fn_printfail "Checking session: FAIL" - fn_scriptlog "Checking session: FAIL" - sleep 1 - echo -en "\n" - if [ "${emailnotification}" = "on" ]; then - subject="${servicename} Monitor - Starting ${servername}" - failurereason="${servicename} process not running" - actiontaken="${servicename} has been restarted" - fn_emailnotification - fi - fn_scriptlog "Monitor is starting ${servername}" - fn_startserver - fi -else - fn_printinfonl "SteamCMD is currently checking for updates" - fn_scriptlog "SteamCMD is currently checking for updates" - sleep 1 - fn_printinfonl "When update is complete ${servicename} will start" - fn_scriptlog "When update is complete ${servicename} will start" - sleep 1 -fi \ No newline at end of file diff --git a/functions/fn_retryinstall b/functions/fn_retryinstall deleted file mode 100644 index 5eb78f55d..000000000 --- a/functions/fn_retryinstall +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# LGSM fn_retryinstall function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -while true; do - read -p "Retry install? [y/N]" yn - case $yn in - [Yy]* ) fn_install; exit;; - [Nn]* ) echo Exiting; exit;; - * ) echo "Please answer yes or no.";; - esac -done \ No newline at end of file diff --git a/functions/fn_rofix b/functions/fn_rofix deleted file mode 100644 index e579261fb..000000000 --- a/functions/fn_rofix +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# LGSM fn_rofix function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -echo "Applying ${gamename} Server Fixes" -echo "=================================" -echo "Applying WebAdmin ROOst.css fix!" -echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" -sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" -sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" -sleep 1 -echo "Applying WebAdmin CharSet fix!" -echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" -sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int" -sleep 1 -echo "applying server name fix." -sleep 1 -echo "forcing server restart..." -sleep 1 -cd "${rootdir}" -${selfname} start -sleep 5 -${selfname} restart -sleep 5 -${selfname} stop \ No newline at end of file diff --git a/functions/fn_rootcheck b/functions/fn_rootcheck deleted file mode 100644 index be99de9d3..000000000 --- a/functions/fn_rootcheck +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# LGSM fn_rootcheck function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -if [ $(whoami) = "root" ]; then - fn_printfailnl "Do NOT run this script as root!" - exit -fi \ No newline at end of file diff --git a/functions/fn_serverconfig b/functions/fn_serverconfig deleted file mode 100644 index b04d7a378..000000000 --- a/functions/fn_serverconfig +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/bash -# LGSM fn_serverconfig function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -fn_arma3config(){ -cp -v lgsm-default.cfg "${servercfgfullpath}" -sleep 1 -echo "" -} - -fn_goldsourceconfig(){ -echo "creating ${servicename}.cfg config file." -cp -v lgsm-default.cfg "${servercfgfullpath}" -sleep 1 -echo "creating server.cfg." -touch "${defaultcfg}" -sleep 1 -echo "creating redirect." -echo "server.cfg > ${servercfg}." -echo "exec ${servercfg}" > "${defaultcfg}" -echo "creating listip.cfg." -sleep 1 -touch "${systemdir}/listip.cfg" -echo "creating banned.cfg." -touch "${systemdir}/banned.cfg" -sleep 1 -if [ -z "${autoinstall}" ]; then - echo "" - echo "Configuring ${gamename} Server" - echo "=================================" - sleep 1 - read -p "Enter server name: " servername - read -p "Enter rcon password: " rconpass -else - servername="${servicename}" - rconpass="rconpassword" -fi -sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}" -sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}" -echo "" -} - -fn_jc2config(){ -cd "${filesdir}" -cp -v default_config.lua config.lua -sleep 1 -echo "" -} - -fn_serious3config(){ -cp -v lgsm-default.ini ${servercfg} -sleep 1 -echo "" -} - -fn_sourceconfig(){ -echo "creating ${servicename}.cfg config file." -cp -v lgsm-default.cfg "${servercfgfullpath}" -sleep 1 -echo "creating server.cfg." -touch "${defaultcfg}" -sleep 1 -echo "creating redirect." -echo "server.cfg > ${servercfg}." -echo "exec ${servercfg}" > "${defaultcfg}" -sleep 1 -if [ -z "${autoinstall}" ]; then - echo "" - echo "Configuring ${gamename} Server" - echo "=================================" - sleep 1 - read -p "Enter server name: " servername - read -p "Enter rcon password: " rconpass -else - servername="${servicename}" - rconpass="rconpassword" -fi -sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}" -sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}" -echo "" -} - -fn_ut99config(){ -echo "${defaultcfg} > ${systemdir}/${ini}" -tr -d '\r' < "${defaultcfg}" > "${systemdir}/${ini}" -sleep 1 -echo "" -echo "Configuring ${gamename} Server" -echo "=================================" -sleep 1 -echo "enabling WebAdmin." -sed -i 's/bEnabled=False/bEnabled=True/g' "${systemdir}/${ini}" -sleep 1 -echo "setting WebAdmin port to 8076." -sed -i '467i\ListenPort=8076' "${systemdir}/${ini}" -sleep 1 -echo "" -} - -fn_unity3dconfig(){ -cp -v serverconfig.xml ${servercfg} -sleep 1 -echo "" -} - -fn_unreal2config(){ -cp -v "${defaultcfg}" "${systemdir}/${ini}" -sleep 1 -echo "" -echo "Configuring ${gamename} Server" -echo "=================================" -sleep 1 -echo "setting WebAdmin username and password." -sed -i 's/AdminName=/AdminName=admin/g' "${systemdir}/${ini}" -sed -i 's/AdminPassword=/AdminPassword=admin/g' "${systemdir}/${ini}" -sleep 1 -echo "enabling WebAdmin." -sed -i 's/bEnabled=False/bEnabled=True/g' "${systemdir}/${ini}" -if [ "${gamename}" == "Unreal Tournament 2004" ]; then - sleep 1 - echo "setting WebAdmin port to 8075." - sed -i 's/ListenPort=80/ListenPort=8075/g' "${systemdir}/${ini}" -fi -sleep 1 -echo "" -} - -echo "" -echo "Creating Configs" -echo "=================================" -sleep 1 -cd "${servercfgdir}" -if [ "${gamename}" == "7 Days To Die" ]; then - fn_unity3dconfig -elif [ "${gamename}" == "ARMA 3" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Arma3/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_arma3config -elif [ "${gamename}" == "Blade Symphony" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Counter Strike 1.6" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeConditionZero/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Counter Strike: Source" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Day of Defeat" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeat/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Day of Defeat: Source" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeatSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Fistful of Frags" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/FistfulOfFrags/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Garrys's Mod" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/GarrysMod/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLife2Deathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLifeDeathmatchClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Insurgency" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Insurgency/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Just Cause 2" ]; then - fn_jc2config -elif [ "${gamename}" == "Killing Floor" ]; then - fn_unreal2config -elif [ "${gamename}" == "Left 4 Dead" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Left 4 Dead 2" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "No More Room in Hell" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/NoMoreRoomInHell/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then - fn_unreal2config -elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then - echo -e "downloading lgsm-default.ini...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/SeriousSam3BFE/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_serious3config -elif [ "${gamename}" == "Team Fortress 2" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortress2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_sourceconfig -elif [ "${gamename}" == "Team Fortress Classic" ]; then - echo -e "downloading lgsm-default.cfg...\c" - wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq - sleep 1 - fn_goldsourceconfig -elif [ "${gamename}" == "Unreal Tournament 2004" ]; then - fn_unreal2config -elif [ "${gamename}" == "Unreal Tournament 99" ]; then - fn_ut99config -fi \ No newline at end of file diff --git a/functions/fn_serverdirectory b/functions/fn_serverdirectory deleted file mode 100644 index 0f9e23a65..000000000 --- a/functions/fn_serverdirectory +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# LGSM fn_serverdirectory function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -echo "" -echo "Server Directory" -echo "=================================" -echo "" -pwd -echo "" -if [ -d "${filesdir}" ]; then - fn_printwarningnl "A server is already installed here." -fi -while true; do - read -p "Continue [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; return 1;; - * ) echo "Please answer yes or no.";; - esac -done \ No newline at end of file diff --git a/functions/fn_servername b/functions/fn_servername deleted file mode 100644 index ce8b61044..000000000 --- a/functions/fn_servername +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# LGSM fn_servername function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 150115 - -# Description: Gets the server name. - -if [ "${engine}" == "avalanche" ]; then - servername=$(grep -s Name "${servercfgfullpath}"|sed 's/Name//g' | tr -d '=\"; '|sed 's/,//g') -elif [ "${engine}" == "realvirtuality" ]; then - servername=$(grep -s hostname "${servercfgfullpath}"| grep -v //|sed -e 's/\//g'| tr -d '=\"; ') -elif [ "${engine}" == "seriousengine35" ]; then - servername=$(grep -s prj_strMultiplayerSessionName "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|sed 's/"//g'|sed 's/;//g') -elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then - servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g') -elif [ "${engine}" == "spark" ]; then - : # Not in config file -elif [ "${engine}" == "unity3d" ]; then - servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"") -elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then - servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g') -fi \ No newline at end of file diff --git a/functions/fn_serverquery b/functions/fn_serverquery deleted file mode 100644 index 271cc039f..000000000 --- a/functions/fn_serverquery +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# LGSM fn_serverquery function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: uses gsquery.py to directly query the server. -# Detects if the server has frozen. - -local modulename="Monitor" -if [ -f gsquery.py ]; then - if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then - gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:]) - port=$((${gameport} + 1)) - elif [ "${engine}" == "spark" ]; then - port=$((${port} + 1)) - elif [ "${engine}" == "realvirtuality" ]; then - queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:]) - port=${queryport} - elif [ "${engine}" == "unity3d" ]; then - gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:]) - port=$((${gameport} + 1)) - fi - fn_printinfo "Detected gsquery.py" - fn_scriptlog "Detected gsquery.py" - sleep 1 - fn_printdots "Querying port: ${ip}:${port} : QUERYING" - fn_scriptlog "Querying port: ${ip}:${port} : QUERYING" - sleep 1 - serverquery=$(./gsquery.py -a ${ip} -p ${port} -e ${engine} 2>&1) - exitcode=$? - if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then - fn_printfail "Querying port: ${ip}:${port} : ${serverquery}" - fn_scriptlog "Querying port: ${ip}:${port} : ${serverquery}" - sleep 1 - echo -en "\n" - if [[ -z "${secondquery}" ]]; then - fn_printinfo "Waiting 30 seconds to re-query" - fn_scriptlog "Waiting 30 seconds to re-query" - sleep 30 - secondquery=1 - fn_serverquery - fi - if [ "${emailnotification}" = "on" ]; then - subject="${servicename} Monitor - Starting ${servername}" - failurereason="Failed to query ${servicename}: ${serverquery}" - actiontaken="restarted ${servicename}" - fn_emailnotification - fi - fn_restartserver - exit - elif [ "${exitcode}" == "0" ]; then - fn_printok "Querying port: ${ip}:${port} : OK" - fn_scriptlog "Querying port: ${ip}:${port} : OK" - sleep 1 - echo -en "\n" - exit - elif [ "${exitcode}" == "126" ]; then - fn_printfail "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied" - fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied" - sleep 1 - echo -en "\n" - echo "Attempting to resolve automatically" - chmod +x -v gsquery.py - exitcode=$? - if [ "${exitcode}" == "0" ]; then - fn_serverquery - else - fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n" - owner=$(ls -al gsquery.py|awk '{ print $3 }') - echo "As user ${owner} or root run the following command." - whoami=$(whoami) - echo -en "\nchown ${whoami}:${whoami} gsquery.py\n\n" - exit - fi - else - fn_printfail "Querying port: ${ip}:${port} : UNKNOWN ERROR" - fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR" - sleep 1 - echo -en "\n" - ./gsquery.py -a ${ip} -p ${port} -e ${engine} - exit - fi -fi \ No newline at end of file diff --git a/functions/fn_startserver b/functions/fn_startserver deleted file mode 100644 index 8801d3a9e..000000000 --- a/functions/fn_startserver +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# LGSM fn_startserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 090115 - -# Description: Starts the server. - -local modulename="Starting" -fn_rootcheck -fn_syscheck -fn_autoip -if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then - startfix=1 - fn_csgofix -fi -fn_parms -fn_logmanager -fn_printdots "${servername}" -fn_scriptlog "${servername}" -sleep 1 -fn_tmuxcheck -fn_steamdl -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") -if [ "${tmuxwc}" -eq 0 ]; then - fn_scriptlog "Rotating log files" - if [ "${engine}" == "unreal2" ]; then - mv "${gamelog}" "${gamelogdate}" - fi - mv "${scriptlog}" "${scriptlogdate}" - mv "${consolelog}" "${consolelogdate}" -fi - -if [ "${tmuxwc}" -eq 1 ]; then - fn_printinfo "${servername} is already running" - fn_scriptlog "${servername} is already running" - sleep 1 - echo -en "\n" - exit -fi -# Create lock file -date > "${rootdir}/${lockselfname}" -cd "${executabledir}" -tmux new-session -d -s ${servicename} "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp" -# tmux pipe-pane not supported in tmux versions < 1.6 -if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then - echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}" - echo "Currently installed: $(tmux -V)" >> "${consolelog}" -else - tmux pipe-pane -o -t ${servicename} "exec cat >> '${consolelog}'" -fi -sleep 1 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") -if [ "${tmuxwc}" -eq 0 ]; then - fn_printfailnl "Unable to start ${servername}" - fn_scriptlog "Unable to start ${servername}" - echo -en " Check log files: ${rootdir}/log" - if [ -a "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then - fn_scriptlog "tmux returned the following error" - cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}" - fi -else - fn_printok "${servername}" - fn_scriptlog "Started ${servername}" -fi -rm "${scriptlogdir}/.${servicename}-tmux-error.tmp" -sleep 1 -echo -en "\n" \ No newline at end of file diff --git a/functions/fn_steamdl b/functions/fn_steamdl deleted file mode 100644 index a091db1d7..000000000 --- a/functions/fn_steamdl +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# LGSM fn_steamdl function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 090115 - -# Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD - - -if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${modulename}" == "Unreal Tournament 2004" ]; then - : # These servers do not require SteamCMD. Check is skipped. -elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then - # Checks if SteamCMD exists when starting or updating a server. - # Re-installs if missing. - if [ ! -f ${rootdir}/steamcmd/steamcmd.sh ]; then - fn_printwarn "SteamCMD is missing" - fn_scriptlog "SteamCMD is missing" - sleep 1 - echo -en "\n" - mkdir -pv "${rootdir}/steamcmd" - cd "${rootdir}/steamcmd" - echo -e "downloading steamcmd_linux.tar.gz...\c" - wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq - tar --verbose -zxf steamcmd_linux.tar.gz - rm -v steamcmd_linux.tar.gz - chmod +x steamcmd.sh - fn_scriptlog "Re-installed SteamCMD" - fn_printdots "${servername}" - sleep 1 - fi - cd "${rootdir}" -else - echo "" - echo "Installing SteamCMD" - echo "=================================" - cd "${rootdir}" - mkdir -pv "steamcmd" - sleep 1 - cd "steamcmd" - if [ ! -f steamcmd.sh ]; then - echo -e "downloading steamcmd_linux.tar.gz...\c" - wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq - tar --verbose -zxf steamcmd_linux.tar.gz - rm -v steamcmd_linux.tar.gz - chmod +x steamcmd.sh - sleep 1 - else - echo "Steam already installed!" - fi - sleep 1 -fi diff --git a/functions/fn_steamfix b/functions/fn_steamfix deleted file mode 100644 index 2de527b63..000000000 --- a/functions/fn_steamfix +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# LGSM fn_libsteamfix function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -fn_steamclientfix(){ -echo "" -echo "Applying steamclient.so fix" -echo "=================================" -sleep 1 -mkdir -pv "${HOME}/.steam" -mkdir -pv "${HOME}/.steam/sdk32" -cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" -sleep 1 -echo "" -} - -# Gary's Mod Specific -fn_libsteamfix(){ -echo "" -echo "Applying libsteam.so fix" -echo "=================================" -sleep 1 -mkdir -pv "${HOME}/.steam" -mkdir -pv "${HOME}/.steam/sdk32" -if [ "${gamename}" == "Garrys's Mod" ]; then - cp -v "${filesdir}/bin/libsteam.so" "${HOME}/.steam/sdk32/libsteam.so" -elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then - mkdir "${HOME}/.steam/bin32" - cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" -fi -sleep 1 -echo "" -} - -fn_steamclientfix -if [ "${gamename}" == "Garrys's Mod" ]||[ "${gamename}" == "Serious Sam 3: BFE" ]; then - fn_libsteamfix -fi \ No newline at end of file diff --git a/functions/fn_steaminstall b/functions/fn_steaminstall deleted file mode 100644 index e56b2805d..000000000 --- a/functions/fn_steaminstall +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# LGSM fn_steaminstall function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 110115 - -fn_steaminstallcommand(){ -counter="0" -while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_steaminstall.tmp)" -ge "1" ]; do - counter=$((counter+1)) - if [ "${counter}" -le "10" ]; then - # Attempt 1-4: Standard attempt - # Attempt 5-6: Validate attempt - # Attempt 7-8: Validate, delete long name dir - # Attempt 9-10: Validate, delete long name dir, re-download SteamCMD - # Attempt 11: Failure - - if [ "${counter}" -ge "2" ]; then - fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}:" - fi - - if [ "${counter}" -ge "7" ]; then - echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')" - find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf - fi - if [ "${counter}" -ge "9" ]; then - rm -rf "${rootdir}/steamcmd" - fn_steamdl - fi - if [ "${counter}" -le "4" ]; then - ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_steaminstall.tmp - elif [ "${counter}" -ge "5" ]; then - ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_steaminstall.tmp - fi - elif [ "${counter}" -ge "11" ]; then - fn_printfailurenl "SteamCMD did not complete the download, too many retrys" - break - fi - -done - -# Goldsource servers commonly fail to download all the server files required. -# Validating a few of times may reduce the chance of this issue. -if [ "${engine}" == "goldsource" ]; then - counter="0" - while [ "${counter}" <= "4" ]; do - counter=$((counter+1)) - ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_steaminstall.tmp - done -fi -rm -f .fn_steaminstall.tmp -} - -echo "" -echo "Installing ${gamename} Server" -echo "=================================" -sleep 1 -mkdir -pv "${filesdir}" -cd "${rootdir}/steamcmd" -fn_steaminstallcommand -if [ -z "${autoinstall}" ]; then - echo "" - echo "=================================" - while true; do - read -p "Was the install successful? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) fn_retryinstall;; - * ) echo "Please answer yes or no.";; - esac - done -fi \ No newline at end of file diff --git a/functions/fn_stopserver b/functions/fn_stopserver deleted file mode 100644 index 36621cde8..000000000 --- a/functions/fn_stopserver +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# LGSM fn_stopserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Stops the server. - -local modulename="Stopping" -fn_rootcheck -fn_syscheck -fn_printdots "${servername}" -fn_scriptlog "${servername}" -sleep 1 -fn_tmuxcheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") -if [ "${pid}" == "0" ]; then - fn_printfail "${servername} is already stopped" - fn_scriptlog "${servername} is already stopped" -else - tmux kill-session -t ${servicename} - fn_printok "${servername}" - fn_scriptlog "Stopped ${servername}" -fi -# Remove lock file -rm -f "${lockselfname}" -sleep 1 -echo -en "\n" \ No newline at end of file diff --git a/functions/fn_syscheck b/functions/fn_syscheck deleted file mode 100644 index 8042f456d..000000000 --- a/functions/fn_syscheck +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# LGSM fn_systemdircheck function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 241214 - -if [ ! -e "${systemdir}" ]; then - fn_printfailnl "Cannot access ${systemdir}: No such directory" - exit -fi \ No newline at end of file diff --git a/functions/fn_tmuxcheck b/functions/fn_tmuxcheck deleted file mode 100644 index bc742bc41..000000000 --- a/functions/fn_tmuxcheck +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# LGSM fn_tmuxcheck function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -# Checks if tmux is installed as too many users do not RTFM or know how to use Google. - -if [ -z $(command -v tmux) ]; then - fn_printfailnl "Tmux not installed" - sleep 1 - fn_scriptlog "Tmux is not installed" - echo " * Tmux is required to run this server." - # Suitable passive agressive message - echo " * Please see 'Prerequisites' section of installation instructions." - exit -fi \ No newline at end of file diff --git a/functions/fn_unreal2compressmaps b/functions/fn_unreal2compressmaps deleted file mode 100644 index 124efcc33..000000000 --- a/functions/fn_unreal2compressmaps +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# LGSM fn_ut2k4compressmaps function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -fn_rootcheck -clear -echo "${gamename} Map Compressor" -echo "============================" -echo "Will compress all maps in:" -echo "" -pwd -echo "" -echo "Compressed maps saved to:" -echo "" -echo "${compressedmapsdir}" -echo "" -while true; do - read -p "Start compression [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; return 1;; - * ) echo "Please answer yes or no.";; - esac -done -mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 -rm -rfv "${filesdir}/Maps/*.uz2" -cd "${systemdir}" -for map in "${filesdir}/Maps/*"; do - ./ucc-bin compress "../Maps/${map}" --nohomedir -done -mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}" diff --git a/functions/fn_updateserver b/functions/fn_updateserver deleted file mode 100644 index 39c08690c..000000000 --- a/functions/fn_updateserver +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# LGSM fn_updateserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 090115 - -# Description: Runs a server update. - -local modulename="Update" -fn_rootcheck -fn_syscheck -fn_printdots "Updating ${servername}" -sleep 1 -fn_steamdl -fn_printok "Updating ${servername}" -fn_scriptlog "Updating ${servername}" -sleep 1 -cd "${rootdir}" -cd "steamcmd" -./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}" diff --git a/functions/fn_uptime b/functions/fn_uptime deleted file mode 100644 index 3414da3a4..000000000 --- a/functions/fn_uptime +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# LGSM fn_uptime function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 141214 -# Depricated: fn_distrodetails has replaced this function. - -uptime=$( "${systemdir}/cdkey" -echo "" \ No newline at end of file diff --git a/functions/fn_ut99compressmaps b/functions/fn_ut99compressmaps deleted file mode 100644 index 23466a01d..000000000 --- a/functions/fn_ut99compressmaps +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# LGSM fn_ut2k4compressmaps function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -fn_rootcheck -clear -echo "${gamename} Map Compressor" -echo "============================" -echo "Will compress all maps in:" -echo "" -pwd -echo "" -echo "Compressed maps saved to:" -echo "" -echo "${compressedmapsdir}" -echo "" -while true; do - read -p "Start compression [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) echo Exiting; return 1;; - * ) echo "Please answer yes or no.";; - esac -done -mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 -rm -rfv "${filesdir}/Maps/*.unr.uz" -cd "${systemdir}" -for map in "${filesdir}/Maps/*"; do - ./ucc-bin compress ../Maps/${map} --nohomedir -done -mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}" diff --git a/functions/fn_ut99filesdl b/functions/fn_ut99filesdl deleted file mode 100644 index f448444bb..000000000 --- a/functions/fn_ut99filesdl +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# LGSM fn_ut99filesdl function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -echo "Downloading Server Files" -echo "=================================" -cd "${rootdir}" -mkdir -pv "${filesdir}" -cd "${filesdir}" -if [ ! -f ut-server-436.tar.gz ]; then - wget http://danielgibbs.co.uk/wp-content/uploads/ut-server-436.tar.gz -else - echo "ut-server-436.tar.gz already downloaded!" -fi -echo "Running MD5 checksum to verify the file" -sleep 1 -echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd" -md5check=$(md5sum ut-server-436.tar.gz|awk '{print $1;}') -echo "File returned: ${md5check}" -if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ]; then - echo "MD5 checksum: FAILED!" - read -p "Retry download? [y/N]" yn - case $yn in - [Yy]* ) rm -fv ut-server-436.tar.gz; fn_filesdl;; - [Nn]* ) echo Exiting; exit;; - * ) echo "Please answer yes or no.";; - esac -else - echo "MD5 checksum: PASSED" -fi -if [ ! -f UTPGPatch451.tar.bz2 ]; then - wget http://danielgibbs.co.uk/wp-content/uploads/UTPGPatch451.tar.bz2 -else - echo "UTPGPatch451.tar.bz2 already downloaded!" -fi -echo "Running MD5 checksum to verify the file" -sleep 1 -echo "MD5 checksum: 77a735a78b1eb819042338859900b83b" -md5check=$(md5sum UTPGPatch451.tar.bz2|awk '{print $1;}') -echo "File returned: ${md5check}" -if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ]; then - echo "MD5 checksum: FAILED!" - read -p "Retry download? [y/N]" yn - case $yn in - [Yy]* ) rm -fv UTPGPatch451.tar.bz2; fn_filesdl;; - [Nn]* ) echo Exiting; exit;; - * ) echo "Please answer yes or no.";; - esac -else - echo "MD5 checksum: PASSED" -fi -echo "" \ No newline at end of file diff --git a/functions/fn_ut99fix b/functions/fn_ut99fix deleted file mode 100644 index 390b85817..000000000 --- a/functions/fn_ut99fix +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# LGSM fn_ut99fix function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -echo "Applying ${gamename} Server Fixes" -echo "=================================" -echo "enabling UdpServerUplink." -{ -echo "[IpServer.UdpServerUplink]" -echo "DoUplink=True" -echo "UpdateMinutes=1" -echo "MasterServerAddress=unreal.epicgames.com" -echo "MasterServerPort=27900" -echo "Region=0" -}|tee -a "${systemdir}/${ini}" > /dev/null 2>&1 -sleep 1 -echo "removing dead mplayer.com master server." -sed -i '/master.mplayer.com/d' "${systemdir}/${ini}" -sleep 1 -echo "inserting qtracker.com master server." -sed -i '66i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${systemdir}/${ini}" -echo "" \ No newline at end of file diff --git a/functions/fn_ut99install b/functions/fn_ut99install deleted file mode 100644 index e1c7bc4f0..000000000 --- a/functions/fn_ut99install +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# LGSM fn_ut99install function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 011214 - -echo "Installing ${gamename} Server" -echo "=================================" -sleep 1 -mkdir -pv "${filesdir}" -cd "${filesdir}" -echo "Extracting ut-server-436.tar.gz" -sleep 1 -tar -zxvf ut-server-436.tar.gz ut-server/ --strip-components=1 -echo "Extracting UTPGPatch451.tar.bz2" -sleep 1 -tar -jxvf UTPGPatch451.tar.bz2 -while true; do - read -p "Was the install successful? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) fn_retryinstall;; - * ) echo "Please answer yes or no.";; -esac -done -while true; do - read -p "Remove ut-server-436.tar.gz? [y/N]" yn - case $yn in - [Yy]* ) rm -fv ut-server-436.tar.gz; break;; - [Nn]* ) break;; - * ) echo "Please answer yes or no.";; - esac -done -while true; do - read -p "Remove UTPGPatch451.tar.bz2? [y/N]" yn - case $yn in - [Yy]* ) rm -fv UTPGPatch451.tar.bz2; break;; - [Nn]* ) break;; - * ) echo "Please answer yes or no.";; - esac -done -echo "" \ No newline at end of file diff --git a/functions/fn_validateserver b/functions/fn_validateserver deleted file mode 100644 index 5ce700280..000000000 --- a/functions/fn_validateserver +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# LGSM fn_validateserver function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Runs a server validation. - -local modulename="Validate" -fn_rootcheck -fn_syscheck -fn_printwarn "Validating may overwrite some customised files." -sleep 1 -echo -en "\n" -echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate" -sleep 5 -echo -en "\n" -fn_printdots "Checking server files" -sleep 1 -fn_printok "Checking server files" -fn_scriptlog "Checking server files" -sleep 1 -cd "${rootdir}" -cd "steamcmd" -./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}" -fn_scriptlog "Checking complete" \ No newline at end of file diff --git a/functions/fn_versioncheck b/functions/fn_versioncheck deleted file mode 100644 index 63d629f55..000000000 --- a/functions/fn_versioncheck +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash -# LGSM fn_versioncheck function -# Author: Daniel Gibbs -# Website: http://danielgibbs.co.uk -# Version: 010115 - -# Description: Checks if a server update is available. - -local modulename="Update" - -fn_steamcmdcheck(){ -# Checks for server update from SteamCMD -fn_printdots "Checking for update: SteamCMD" -fn_scriptlog "Checking for update: SteamCMD" -sleep 1 -currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) -cd "${rootdir}/steamcmd" -availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_print ${appid} +app_info_print ${appid} +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) -if [ -z "${availablebuild}" ]; then - fn_printfail "Checking for update: SteamCMD" - fn_scriptlog "Failure! Checking for update: SteamCMD" - sleep 1 - fn_printfail "Checking for update: SteamCMD: Not returning version info" - fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info" - sleep 2 -else - fn_printok "Checking for update: SteamCMD" - fn_scriptlog "Success! Checking for update: SteamCMD" - sleep 1 -fi - -if [ -z "${availablebuild}" ]; then - # Checks for server update from SteamDB.info if SteamCMD fails - echo "" - fn_printdots "Checking for update: SteamDB.info" - fn_scriptlog "Checking for update: SteamDB.info" - availablebuild=$(wget -qO- "http://steamdb.info/api/GetRawDepots/?appid=${appid}" | sed 's/\\n/\n/g' | grep -EA 1000 "^\s+\[branches\]" | grep -EA 5 "^\s+\[public\]" | grep -m 1 -EB 10 "^\s+\)$" | grep -E "^\s+\[buildid\]\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f4) - sleep 1 - if [ -z "${availablebuild}" ]; then - fn_printfail "Checking for update: SteamDB.info" - fn_scriptlog "Failure! Checking for update: SteamDB.info" - sleep 1 - fn_printfail "Checking for update: SteamDB.info: Not returning version info" - fn_scriptlog "Failure! Checking for update: SteamDB.info: Not returning version info" - sleep 2 - else - fn_printok "Checking for update: SteamDB.info" - fn_scriptlog "Success! Checking for update: SteamDB.info" - sleep 1 - fi -fi -if [ -z "${availablebuild}" ]; then - fn_logupdaterequest -fi - -if [ "${currentbuild}" -ne "${availablebuild}" ]; then - echo -e "\n" - echo -e "Update available:" - sleep 1 - echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m" - echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m" - echo -e "" - echo -e " https://steamdb.info/app/${appid}/" - sleep 1 - echo "" - echo -en "Applying update.\r" - sleep 1 - echo -en "Applying update..\r" - sleep 1 - echo -en "Applying update...\r" - sleep 1 - echo -en "\n" - fn_scriptlog "Update available" - fn_scriptlog "Current build: ${currentbuild}" - fn_scriptlog "Available build: ${availablebuild}" - fn_scriptlog "${currentbuild} > ${availablebuild}" - if [ ! -z "${norestart}" ]; then - fn_updateserver - else - fn_stopserver - fn_updateserver - fn_startserver - fi -else - echo -e "\n" - echo -e "No update available:" - echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m" - echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m" - echo -e " https://steamdb.info/app/${appid}/" - echo -e "" - fn_printoknl "No update available" - fn_scriptlog "Current build: ${currentbuild}" - fn_scriptlog "Available build: ${availablebuild}" -fi -} - -fn_logupdaterequest(){ -# Checks for server update requests from server logs. -echo "" -fn_printdots "Checking server logs for update requests" -sleep 1 -fn_printok "Checking server logs for update requests" -fn_scriptlog "Checking server logs for update requests" -sleep 1 -requestrestart=$(grep -sc "MasterRequestRestart" "${consolelog}") -if [ "${requestrestart}" -ge "1" ]; then - fn_printoknl "Server requesting update" - sleep 1 - echo "" - echo -ne "Applying update.\r" - sleep 1 - echo -ne "Applying update..\r" - sleep 1 - echo -ne "Applying update...\r" - sleep 1 - echo -ne "\n" - if [ ! -z "${norestart}" ]; then - fn_updateserver - else - fn_stopserver - fn_updateserver - fn_startserver - fi -else - fn_printok "No update request detected" - sleep 1 -fi -echo "" -exit -} - - -fn_appmanifestinfo(){ - appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf") - appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l) -} - -fn_appmanifestcheck(){ -fn_appmanifestinfo -# Multiple or no matching appmanifest files may sometimes be available. -# This is an error is corrected below if required. -if [ "${appmanifestfilewc}" -ge "2" ]; then - sleep 1 - fn_printwarn "Multiple appmanifest_${appid}.acf files found" - fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found" - sleep 2 - fn_printdots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" - sleep 1 - for appfile in ${appmanifestfile}; do - rm "${appfile}" - done - appmanifestfilewc1="${appmanifestfilewc}" - fn_appmanifestinfo - if [ "${appmanifestfilewc}" -ge "2" ]; then - fn_printfail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" - fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" - sleep 1 - echo "" - echo " Check user permissions" - for appfile in ${appmanifestfile}; do - echo " ${appfile}" - done - exit - else - sleep 1 - fn_printok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" - fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" - sleep 1 - fn_printinfonl "Forcing update to correct issue" - fn_scriptlog "Forcing update to correct issue" - sleep 1 - fn_updateserver - fn_versioncheck - fi -elif [ "${appmanifestfilewc}" -eq "0" ]; then - fn_printwarn "No appmanifest_${appid}.acf found" - fn_scriptlog "Warning! No appmanifest_${appid}.acf found" - sleep 2 - fn_printinfonl "Forcing update to correct issue" - fn_scriptlog "Forcing update to correct issue" - sleep 1 - fn_updateserver - fn_versioncheck -fi -} - -fn_printdots "Checking for update" -fn_appmanifestcheck -fn_steamcmdcheck \ No newline at end of file