diff --git a/lgsm/functions/check.sh b/lgsm/functions/check.sh
index aa9ab63ab..93d1f119a 100644
--- a/lgsm/functions/check.sh
+++ b/lgsm/functions/check.sh
@@ -2,7 +2,7 @@
# LGSM fn_check function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="060316"
+lgsm_version="060516"
# Description: Overall function for managing checks.
# Runs checks that will either halt on or fix an issue.
@@ -70,3 +70,11 @@ do
check_config.sh
fi
done
+
+local allowed_commands_array=( command_details.sh command_monitor.sh command_start.sh command_stop.sh command_ts3_server_pass.sh update_check.sh command_details.sh command_validate.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+ if [ "${allowed_command}" == "${function_selfname}" ]; then
+ check_status.sh
+ fi
+done
diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh
new file mode 100644
index 000000000..d0f88b080
--- /dev/null
+++ b/lgsm/functions/check_status.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# LGSM check_status function
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+lgsm_version="060516"
+
+# Description: Checks the proccess status of the server. Either online or offline.
+
+if [ "${gamename}" == "Teamspeak 3" ]; then
+ # 1: Server is running
+ # 0: Server seems to have died
+ # 0: No server running (ts3server.pid is missing)
+ status=$(./ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
+ if [ "${status}" == "Server is running" ]; then
+ status=1
+ else
+ status=0
+ ts3error=$(./ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
+ fi
+else
+ status=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
+fi
diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh
index 68746c1c5..d2426029c 100644
--- a/lgsm/functions/command_backup.sh
+++ b/lgsm/functions/command_backup.sh
@@ -2,7 +2,7 @@
# LGSM command_backup.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="190316"
+lgsm_version="060516"
# Description: Creates a .tar.gz file in the backup directory.
@@ -24,8 +24,8 @@ while true; do
esac
done
echo ""
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
+check_status.sh
+if [ "${status}" != "0" ]; then
echo ""
fn_printwarningnl "${servicename} is currently running."
sleep 1
diff --git a/lgsm/functions/command_console.sh b/lgsm/functions/command_console.sh
index f7f2c1323..3a67be820 100644
--- a/lgsm/functions/command_console.sh
+++ b/lgsm/functions/command_console.sh
@@ -2,7 +2,7 @@
# LGSM command_console.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="060516"
# Description: Gives access to the server tmux console.
@@ -27,8 +27,8 @@ esac
done
fn_print_dots "Starting"
sleep 1
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
+check_status.sh
+if [ "${status}" != "0" ]; then
fn_print_ok_nl "Starting"
fn_scriptlog "accessed"
sleep 1
diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh
index 88c4286fe..c601769e1 100644
--- a/lgsm/functions/command_details.sh
+++ b/lgsm/functions/command_details.sh
@@ -2,7 +2,7 @@
# LGSM command_details.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="230216"
+lgsm_version="060516"
# Description: Displays server infomation.
@@ -12,174 +12,206 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# This applies to all engines
fn_details_os(){
-echo -e ""
-echo -e "\e[93mDistro Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mDistro:\t\e[0m${os}"
- echo -e "\e[34mArch:\t\e[0m${arch}"
- echo -e "\e[34mKernel:\t\e[0m${kernel}"
- echo -e "\e[34mHostname:\t\e[0m$HOSTNAME"
- echo -e "\e[34mtmux:\t\e[0m${tmuxv}"
- echo -e "\e[34mGLIBC:\t\e[0m${glibcv}"
-} | column -s $'\t' -t
+ #
+ # Distro Details
+ # =====================================
+ # Distro: Ubuntu 14.04.4 LTS
+ # Arch: x86_64
+ # Kernel: 3.13.0-79-generic
+ # Hostname: hostname
+ # tmux: tmux 1.8
+ # GLIBC: 2.19
+
+ echo -e ""
+ echo -e "\e[93mDistro Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mDistro:\t\e[0m${os}"
+ echo -e "\e[34mArch:\t\e[0m${arch}"
+ echo -e "\e[34mKernel:\t\e[0m${kernel}"
+ echo -e "\e[34mHostname:\t\e[0m$HOSTNAME"
+ echo -e "\e[34mtmux:\t\e[0m${tmuxv}"
+ echo -e "\e[34mGLIBC:\t\e[0m${glibcv}"
+ } | column -s $'\t' -t
}
fn_details_performance(){
-echo -e ""
-echo -e "\e[93mPerformance\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m"
- echo -e "\e[34mAvg Load:\t\e[0m${load}"
-} | column -s $'\t' -t
-echo -e ""
-{
- echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m"
- echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m"
- echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m"
-} | column -s $'\t' -t
+ #
+ # Performance
+ # =====================================
+ # Uptime: 55d, 3h, 38m
+ # Avg Load: 1.00, 1.01, 0.78
+ #
+ # Mem: total used free
+ # Physical: 741M 656M 85M
+ # Swap: 0B 0B 0B
+
+ echo -e ""
+ echo -e "\e[93mPerformance\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mUptime:\t\e[0m${days}d, ${hours}h, ${minutes}m"
+ echo -e "\e[34mAvg Load:\t\e[0m${load}"
+ } | column -s $'\t' -t
+ echo -e ""
+ {
+ echo -e "\e[34mMem:\t\e[34mtotal\t used\t free\e[0m"
+ echo -e "\e[34mPhysical:\t\e[0m${physmemtotal}\t${physmemused}\t${physmemfree}\e[0m"
+ echo -e "\e[34mSwap:\t\e[0m${swaptotal}\t${swapused}\t${swapfree}\e[0m"
+ } | column -s $'\t' -t
}
fn_details_disk(){
-echo -e ""
-echo -e "\e[93mStorage\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
- echo -e "\e[34mTotal:\t\e[0m${totalspace}"
- echo -e "\e[34mUsed:\t\e[0m${usedspace}"
- echo -e "\e[34mAvailable:\t\e[0m${availspace}"
- echo -e "\e[34mServerfiles:\t\e[0m${filesdirdu}"
- if [ -d "${backupdir}" ]; then
- echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
- fi
-} | column -s $'\t' -t
+ #
+ # Storage
+ # =====================================
+ # Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff
+ # Total: 15G
+ # Used: 8.4G
+ # Available: 5.7G
+ # Serverfiles: 961M
+
+ echo -e ""
+ echo -e "\e[93mStorage\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ echo -e "\e[34mFilesystem:\t\e[0m${filesystem}"
+ echo -e "\e[34mTotal:\t\e[0m${totalspace}"
+ echo -e "\e[34mUsed:\t\e[0m${usedspace}"
+ echo -e "\e[34mAvailable:\t\e[0m${availspace}"
+ echo -e "\e[34mServerfiles:\t\e[0m${filesdirdu}"
+ if [ -d "${backupdir}" ]; then
+ echo -e "\e[34mBackups:\t\e[0m${backupdirdu}"
+ fi
+ } | column -s $'\t' -t
}
fn_details_gameserver(){
-echo -e ""
+ #
+ # Quake Live Server Details
+ # =====================================
+ # Server name: ql-server
+ # Server IP: 1.2.3.4:27960
+ # RCON password: CHANGE_ME
+ # Server password: NOT SET
+ # Slots: 16
+ # Status: OFFLINE
-## server details
-echo -e "\e[92m${gamename} Server Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- # server name
- echo -e "\e[34mServer name:\t\e[0m${servername}"
+ echo -e ""
+ echo -e "\e[92m${gamename} Server Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ # Server name
+ echo -e "\e[34mServer name:\t\e[0m${servername}"
- # server ip
- echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}"
+ # Server ip
+ echo -e "\e[34mServer IP:\t\e[0m${ip}:${port}"
- # rcon password
- if [ -n "${rconpassword}" ]; then
- echo -e "\e[34mRCON password:\t\e[0m${rconpassword}"
- fi
+ # Server password
+ if [ -n "${serverpassword}" ]; then
+ echo -e "\e[34mServer password:\t\e[0m${serverpassword}"
+ fi
- # server password
- if [ -n "${serverpassword}" ]; then
- echo -e "\e[34mServer password:\t\e[0m${serverpassword}"
- fi
+ # RCON password
+ if [ -n "${rconpassword}" ]; then
+ echo -e "\e[34mRCON password:\t\e[0m${rconpassword}"
+ fi
- # admin password
- if [ -n "${adminpassword}" ]; then
- echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}"
- fi
+ # Admin password
+ if [ -n "${adminpassword}" ]; then
+ echo -e "\e[34mAdmin password:\t\e[0m${adminpassword}"
+ fi
- # slots
- if [ -n "${slots}" ]; then
- echo -e "\e[34mSlots:\t\e[0m${slots}"
- fi
+ # Stats password (Quake Live)
+ if [ -n "${statspassword}" ]; then
+ echo -e "\e[34mStats password:\t\e[0m${statspassword}"
+ fi
- # game mode
- if [ -n "${gamemode}" ]; then
- echo -e "\e[34mGame mode:\t\e[0m${gamemode}"
- fi
+ # Slots
+ if [ -n "${slots}" ]; then
+ echo -e "\e[34mSlots:\t\e[0m${slots}"
+ fi
- # game world
- if [ -n "${gameworld}" ]; then
- echo -e "\e[34mGame world:\t\e[0m${gameworld}"
- fi
+ # Game mode
+ if [ -n "${gamemode}" ]; then
+ echo -e "\e[34mGame mode:\t\e[0m${gamemode}"
+ fi
- # tick rate
- if [ -n "${tickrate}" ]; then
- echo -e "\e[34mTick rate:\t\e[0m${tickrate}"
- fi
+ # Game world
+ if [ -n "${gameworld}" ]; then
+ echo -e "\e[34mGame world:\t\e[0m${gameworld}"
+ fi
- # online status
- if [ "${gamename}" == "Teamspeak 3" ]; then
- info_ts3status.sh
- if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
- echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
- else
- echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
+ # Tick rate
+ if [ -n "${tickrate}" ]; then
+ echo -e "\e[34mTick rate:\t\e[0m${tickrate}"
fi
- else
- pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
- if [ "${pid}" == "0" ]; then
+
+ # teamspeak dbplugin
+ if [ -n "${dbplugin}" ]; then
+ echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}"
+ fi
+
+ # online status
+ if [ "${status}" == "0" ]; then
echo -e "\e[34mStatus:\t\e[0;31mOFFLINE\e[0m"
else
echo -e "\e[34mStatus:\t\e[0;32mONLINE\e[0m"
fi
- fi
-
- # teamspeak dbplugin
- if [ -n "${dbplugin}" ]; then
- echo -e "\e[34mdbplugin:\t\e[0m${dbplugin}"
- fi
-} | column -s $'\t' -t
-echo -e ""
-
-## script details
-echo -e "\e[92m${selfname} Script Details\e[0m"
-printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
-{
- # service name
- echo -e "\e[34mService name:\t\e[0m${servicename}"
+ } | column -s $'\t' -t
+ echo -e ""
- # script version
- if [ -n "${version}" ]; then
- echo -e "\e[34m${selfname} version:\t\e[0m${version}"
- fi
+ ## script details
+ echo -e "\e[92m${selfname} Script Details\e[0m"
+ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
+ {
+ # service name
+ echo -e "\e[34mService name:\t\e[0m${servicename}"
- # script user
- echo -e "\e[34mUser:\t\e[0m$(whoami)"
+ # script version
+ if [ -n "${version}" ]; then
+ echo -e "\e[34m${selfname} version:\t\e[0m${version}"
+ fi
- # GLIBC required
- if [ -n "${glibcrequired}" ] && [ "${glibcrequired}" != "UNKNOWN" ]; then
- if [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt "$(echo "${glibcrequired}" | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" ]; then
- if [ "${glibcfix}" == "yes" ]; then
- echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)"
+ # script user
+ echo -e "\e[34mUser:\t\e[0m$(whoami)"
+
+ # GLIBC required
+ if [ -n "${glibcrequired}" ] && [ "${glibcrequired}" != "UNKNOWN" ]; then
+ if [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt "$(echo "${glibcrequired}" | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" ]; then
+ if [ "${glibcfix}" == "yes" ]; then
+ echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired} \e[0m(\e[0;32mUsing GLIBC fix\e[0m)"
+ else
+ echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}\e[0m(\e[0;32mGLIBC version too old\e[0m)"
+ fi
else
- echo -e "\e[34mGLIBC required:\t\e[0;31m${glibcrequired}\e[0m(\e[0;32mGLIBC version too old\e[0m)"
+ echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m"
fi
- else
- echo -e "\e[34mGLIBC required:\t\e[0;32m${glibcrequired}\e[0m"
fi
- fi
- # email notification
- if [ -n "${emailnotification}" ]; then
- echo -e "\e[34mEmail notification:\t\e[0m${emailnotification}"
- fi
+ # email notification
+ if [ -n "${emailnotification}" ]; then
+ echo -e "\e[34mEmail notification:\t\e[0m${emailnotification}"
+ fi
- # update on start
- if [ -n "${updateonstart}" ]; then
- echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}"
- fi
+ # update on start
+ if [ -n "${updateonstart}" ]; then
+ echo -e "\e[34mUpdate on start:\t\e[0m${updateonstart}"
+ fi
- # script location
- echo -e "\e[34mLocation:\t\e[0m${rootdir}"
+ # script location
+ echo -e "\e[34mLocation:\t\e[0m${rootdir}"
- # config file location
- if [ -n "${servercfgfullpath}" ]; then
- echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}"
- fi
+ # config file location
+ if [ -n "${servercfgfullpath}" ]; then
+ echo -e "\e[34mConfig file:\t\e[0m${servercfgfullpath}"
+ fi
- # network config file location (ARMA 3)
- if [ -n "${networkcfgfullpath}" ]; then
- echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}"
- fi
-} | column -s $'\t' -t
+ # network config file location (ARMA 3)
+ if [ -n "${networkcfgfullpath}" ]; then
+ echo -e "\e[34mNetwork config file:\t\e[0m${networkcfgfullpath}"
+ fi
+ } | column -s $'\t' -t
}
fn_details_backup(){
diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh
index 066d0dbdf..3a7d9f468 100644
--- a/lgsm/functions/command_monitor.sh
+++ b/lgsm/functions/command_monitor.sh
@@ -2,7 +2,7 @@
# LGSM command_monitor.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="060516"
# Description: Monitors server by checking for running proccesses
# then passes to monitor_gsquery.sh.
@@ -22,8 +22,7 @@ fn_monitor_check_lockfile(){
fn_monitor_check_update(){
# Monitor will not check if update is running.
- updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)
- if [ "${updatecheck}" >= "1" ]; then
+ if [ "$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)" >= "1" ]; then
fn_print_info_nl "SteamCMD is currently checking for updates"
fn_scriptlog "SteamCMD is currently checking for updates"
sleep 1
@@ -49,17 +48,16 @@ fn_monitor_email_notification(){
}
fn_monitor_teamspeak3(){
- info_ts3status.sh
- if [ "${ts3status}" = "Server is running" ]; then
+ if [ "${status}" != "0" ]; then
fn_print_ok "Checking session: "
fn_print_ok_eol_nl
fn_scriptlog "Checking session: OK"
exit
else
- fn_print_fail "Checking session: ${ts3status}: "
+ fn_print_fail "Checking session: ${ts3error}: "
fn_print_fail_eol_nl
- fn_scriptlog "Checking session: ${ts3status}: FAIL"
- failurereason="${ts3status}"
+ fn_scriptlog "Checking session: ${ts3error}: FAIL"
+ failurereason="${ts3error}"
fn_monitor_email_notification
fi
fn_scriptlog "Monitor is starting ${servername}"
@@ -69,8 +67,7 @@ fn_monitor_teamspeak3(){
fn_monitor_tmux(){
# checks that tmux session is running
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
- if [ "${tmuxwc}" == "1" ]; then
+ if [ "${status}" != "0" ]; then
fn_print_ok "Checking session: OK"
fn_print_ok_eol_nl
fn_scriptlog "Checking session: OK"
diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh
index ff8bd9648..5b274f32f 100644
--- a/lgsm/functions/command_start.sh
+++ b/lgsm/functions/command_start.sh
@@ -2,7 +2,7 @@
# LGSM command_start.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="070116"
+lgsm_version="060516"
# Description: Starts the server.
@@ -10,16 +10,6 @@ local modulename="Starting"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_start_teamspeak3(){
- check.sh
- info_ts3status.sh
-
- if [ "${ts3status}" != "Server is running" ]; then
- # Will check for updates is updateonstart is yes
- if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
- update_check.sh
- fi
- fi
-
if [ ! -e "${servercfgfullpath}" ]; then
fn_print_warn_nl "${servercfgfullpath} is missing"
fn_scriptlog "${servercfgfullpath} is missing"
@@ -35,13 +25,11 @@ fn_start_teamspeak3(){
touch "${servercfgfullpath}"
fi
- logs.sh
-
fn_print_dots "${servername}"
fn_scriptlog "${servername}"
sleep 1
-
- if [ "${ts3status}" == "Server is running" ]; then
+ check_status.sh
+ if [ "${status}" != "0" ]; then
fn_print_info_nl "${servername} is already running"
fn_scriptlog "${servername} is already running"
exit
@@ -57,8 +45,8 @@ fn_start_teamspeak3(){
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
fi
sleep 1
- info_ts3status.sh
- if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
+ check_status.sh
+ if [ "${status}" == "0" ]; then
fn_print_fail_nl "Unable to start ${servername}"
fn_scriptlog "Unable to start ${servername}"
echo -e " Check log files: ${rootdir}/log"
@@ -70,117 +58,126 @@ fn_start_teamspeak3(){
}
fn_start_tmux(){
-check.sh
-fix.sh
-info_config.sh
-fn_parms
-logs.sh
+ fn_print_dots "${servername}"
+ fn_scriptlog "${servername}"
+ sleep 1
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-# Will check for updates if updateonstart is yes
-if [ "${tmuxwc}" -eq 0 ]; then
- if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
- update_check.sh
+ # Log rotation
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_scriptlog "Rotating log files"
+ if [ "${engine}" == "unreal2" ]; then
+ mv "${gamelog}" "${gamelogdate}"
+ fi
+ mv "${scriptlog}" "${scriptlogdate}"
+ mv "${consolelog}" "${consolelogdate}"
fi
-fi
-
-fn_print_dots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-if [ "${tmuxwc}" -eq 0 ]; then
- fn_scriptlog "Rotating log files"
- if [ "${engine}" == "unreal2" ]; then
- mv "${gamelog}" "${gamelogdate}"
+ # If server is already running exit
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ fn_print_info_nl "${servername} is already running"
+ fn_scriptlog "${servername} is already running"
+ exit
fi
- mv "${scriptlog}" "${scriptlogdate}"
- mv "${consolelog}" "${consolelogdate}"
-fi
-
-if [ "${tmuxwc}" -eq 1 ]; then
- fn_print_info_nl "${servername} is already running"
- fn_scriptlog "${servername} is already running"
- exit
-fi
-# Create lock file
-date > "${rootdir}/${lockselfname}"
-cd "${executabledir}"
-tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-# tmux pipe-pane not supported in tmux versions < 1.6
-if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
- echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
- echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
- echo "Currently installed: $(tmux -V)" >> "${consolelog}"
-elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
- echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
- echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
- echo "Currently installed: $(tmux -V)" >> "${consolelog}"
-# Console logging enable or not set
-elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
- touch "${consolelog}"
- tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
-# Console logging disabled
-elif [ "${consolelogging}" == "off" ]; then
- touch "${consolelog}"
- cat "Console logging disabled by user" >> "{consolelog}"
- fn_scriptlog "Console logging disabled by user"
-fi
-sleep 1
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-# If the server fails to start
-if [ "${tmuxwc}" -eq 0 ]; then
- fn_print_fail_nl "Unable to start ${servername}"
- fn_scriptlog "Unable to start ${servername}"
+ # Create lock file
+ date > "${rootdir}/${lockselfname}"
+ cd "${executabledir}"
+ tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+
+ # tmux pipe-pane not supported in tmux versions < 1.6
+ if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
+ echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
+ echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
+ echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+
+ # Console logging disabled: Bug in tmux 1.8 breaks logging
+ elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
+ echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
+ echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}"
+ echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+
+ # Console logging enable or not set
+ elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+ touch "${consolelog}"
+ tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
+
+ # Console logging disabled
+ elif [ "${consolelogging}" == "off" ]; then
+ touch "${consolelog}"
+ cat "Console logging disabled by user" >> "{consolelog}"
+ fn_scriptlog "Console logging disabled by user"
+ fi
sleep 1
- if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
- fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
- fn_scriptlog "Tmux error"
- echo ""
- echo "Command"
- echo "================================="
- echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
- echo ""
- echo "Error"
- echo "================================="
- cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
-
- # Detected error http://gameservermanagers.com/issues
- if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
- echo ""
- echo "Fix"
- echo "================================="
- if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ]; then
- echo "$(whoami) is not part of the tty group."
- fn_scriptlog "$(whoami) is not part of the tty group."
- group=$(grep tty /etc/group)
- echo ""
- echo " ${group}"
- fn_scriptlog "${group}"
- echo ""
- echo "Run the following command with root privileges."
- echo ""
- echo " usermod -G tty $(whoami)"
- echo ""
- echo "http://gameservermanagers.com/tmux-op-perm"
- fn_scriptlog "http://gameservermanagers.com/tmux-op-perm"
- else
- echo "No known fix currently. Please log an issue."
- fn_scriptlog "No known fix currently. Please log an issue."
- echo "http://gameservermanagers.com/issues"
- fn_scriptlog "http://gameservermanagers.com/issues"
+
+ # If the server fails to start
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ fn_print_fail_nl "Unable to start ${servername}"
+ fn_scriptlog "Unable to start ${servername}"
+ sleep 1
+ if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
+ fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
+ fn_scriptlog "Tmux error"
+ echo ""
+ echo "Command"
+ echo "================================="
+ echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
+ echo ""
+ echo "Error"
+ echo "================================="
+ cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
+
+ # Detected error http://gameservermanagers.com/issues
+ if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
+ echo ""
+ echo "Fix"
+ echo "================================="
+ if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ]; then
+ echo "$(whoami) is not part of the tty group."
+ fn_scriptlog "$(whoami) is not part of the tty group."
+ group=$(grep tty /etc/group)
+ echo ""
+ echo " ${group}"
+ fn_scriptlog "${group}"
+ echo ""
+ echo "Run the following command with root privileges."
+ echo ""
+ echo " usermod -G tty $(whoami)"
+ echo ""
+ echo "http://gameservermanagers.com/tmux-op-perm"
+ fn_scriptlog "http://gameservermanagers.com/tmux-op-perm"
+ else
+ echo "No known fix currently. Please log an issue."
+ fn_scriptlog "No known fix currently. Please log an issue."
+ echo "http://gameservermanagers.com/issues"
+ fn_scriptlog "http://gameservermanagers.com/issues"
+ fi
fi
fi
+ exit 1
+ else
+ fn_print_ok "${servername}"
+ fn_scriptlog "Started ${servername}"
fi
-exit 1
-else
- fn_print_ok "${servername}"
- fn_scriptlog "Started ${servername}"
-fi
-rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-echo -en "\n"
+ rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+ echo -en "\n"
}
+check.sh
+fix.sh
+info_config.sh
+fn_parms
+logs.sh
+
+# Will check for updates is updateonstart is yes
+if [ "${status}" == "0" ]; then
+ if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+ update_check.sh
+ fi
+fi
+
if [ "${gamename}" == "Teamspeak 3" ]; then
fn_start_teamspeak3
else
diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh
index f4c46c071..4e658ccf5 100644
--- a/lgsm/functions/command_validate.sh
+++ b/lgsm/functions/command_validate.sh
@@ -36,9 +36,8 @@ fix.sh
fn_scriptlog "Checking complete"
}
-check.sh
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-if [ "${tmuxwc}" -eq 1 ]; then
+check_status.sh
+if [ "${status}" != "0" ]; then
command_stop.sh
fn_validation
command_start.sh
diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh
index 77a3cffb7..266a831a9 100644
--- a/lgsm/functions/core_functions.sh
+++ b/lgsm/functions/core_functions.sh
@@ -2,7 +2,7 @@
# LGSM core_functions.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="020516"
+lgsm_version="060516"
# Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
# This function is called first before any other function. Without this file other functions would not load.
@@ -207,6 +207,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
+check_status.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
check_steamcmd.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
diff --git a/lgsm/functions/update_check.sh b/lgsm/functions/update_check.sh
index 579a84f4b..e09eb54f2 100644
--- a/lgsm/functions/update_check.sh
+++ b/lgsm/functions/update_check.sh
@@ -2,7 +2,7 @@
# LGSM update_check.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
-lgsm_version="060216"
+lgsm_version="060516"
# Description: Checks if a server update is available.
@@ -17,292 +17,294 @@ fn_appmanifestinfo(){
}
fn_appmanifestcheck(){
-fn_appmanifestinfo
-# Multiple or no matching appmanifest files may sometimes be available.
-# This is an error is corrected below if required.
-if [ "${appmanifestfilewc}" -ge "2" ]; then
- sleep 1
- fn_print_warn "Multiple appmanifest_${appid}.acf files found"
- fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
- sleep 2
- fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
- sleep 1
- for appfile in ${appmanifestfile}; do
- rm "${appfile}"
- done
- appmanifestfilewc1="${appmanifestfilewc}"
fn_appmanifestinfo
+ # Multiple or no matching appmanifest files may sometimes be available.
+ # This is an error is corrected below if required.
if [ "${appmanifestfilewc}" -ge "2" ]; then
- fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
- fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
sleep 1
- echo ""
- echo " Check user permissions"
+ fn_print_warn "Multiple appmanifest_${appid}.acf files found"
+ fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
+ sleep 2
+ fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ sleep 1
for appfile in ${appmanifestfile}; do
- echo " ${appfile}"
+ rm "${appfile}"
done
- exit 1
- else
- sleep 1
- fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
- fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
- sleep 1
+ appmanifestfilewc1="${appmanifestfilewc}"
+ fn_appmanifestinfo
+ if [ "${appmanifestfilewc}" -ge "2" ]; then
+ fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
+ sleep 1
+ echo ""
+ echo " Check user permissions"
+ for appfile in ${appmanifestfile}; do
+ echo " ${appfile}"
+ done
+ exit 1
+ else
+ sleep 1
+ fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
+ fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
+ sleep 1
+ fn_print_info_nl "Forcing update to correct issue"
+ fn_scriptlog "Forcing update to correct issue"
+ sleep 1
+ update_dl.sh
+ update_check.sh
+ fi
+ elif [ "${appmanifestfilewc}" -eq "0" ]; then
+ if [ "${forceupdate}" == "1" ]; then
+ fn_print_fail "Still no appmanifest_${appid}.acf found: Unable to update"
+ fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
+ exit 1
+ fi
+ forceupdate=1
+ fn_print_warn "No appmanifest_${appid}.acf found"
+ fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
+ sleep 2
fn_print_info_nl "Forcing update to correct issue"
fn_scriptlog "Forcing update to correct issue"
sleep 1
update_dl.sh
update_check.sh
fi
-elif [ "${appmanifestfilewc}" -eq "0" ]; then
- if [ "${forceupdate}" == "1" ]; then
- fn_print_fail "Still no appmanifest_${appid}.acf found: Unable to update"
- fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
- exit 1
- fi
- forceupdate=1
- fn_print_warn "No appmanifest_${appid}.acf found"
- fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
- sleep 2
- fn_print_info_nl "Forcing update to correct issue"
- fn_scriptlog "Forcing update to correct issue"
- sleep 1
- update_dl.sh
- update_check.sh
-fi
}
fn_logupdaterequest(){
-# Checks for server update requests from server logs.
-fn_print_dots "Checking for update: Server logs"
-fn_scriptlog "Checking for update: Server logs"
-sleep 1
-requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
-if [ "${requestrestart}" -ge "1" ]; then
- fn_print_ok_nl "Checking for update: Server logs: Update requested"
- sleep 1
- echo ""
- echo -ne "Applying update.\r"
+ # Checks for server update requests from server logs.
+ fn_print_dots "Checking for update: Server logs"
+ fn_scriptlog "Checking for update: Server logs"
sleep 1
- echo -ne "Applying update..\r"
- sleep 1
- echo -ne "Applying update...\r"
- sleep 1
- echo -ne "\n"
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- unset updateonstart
- if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- update_dl.sh
- command_start.sh
+ requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
+ if [ "${requestrestart}" -ge "1" ]; then
+ fn_print_ok_nl "Checking for update: Server logs: Update requested"
+ sleep 1
+ echo ""
+ echo -ne "Applying update.\r"
+ sleep 1
+ echo -ne "Applying update..\r"
+ sleep 1
+ echo -ne "Applying update...\r"
+ sleep 1
+ echo -ne "\n"
+
+ unset updateonstart
+ check_status.sh
+ if [ "${status}" != "0" ]; then
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ else
+ update_dl.sh
+ fi
else
- update_dl.sh
+ fn_print_ok "Checking for update: Server logs: No update requested"
+ sleep 1
fi
-else
- fn_print_ok "Checking for update: Server logs: No update requested"
- sleep 1
-fi
}
fn_steamcmdcheck(){
-fn_appmanifestcheck
-# Checks for server update from SteamCMD
-fn_print_dots "Checking for update: SteamCMD"
-fn_scriptlog "Checking for update: SteamCMD"
-sleep 1
+ fn_appmanifestcheck
+ # Checks for server update from SteamCMD
+ fn_print_dots "Checking for update: SteamCMD"
+ fn_scriptlog "Checking for update: SteamCMD"
+ sleep 1
-# Gets currentbuild
-currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
+ # Gets currentbuild
+ currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
-# Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD
+ # Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD
-# Gets availablebuild info
-cd "${rootdir}/steamcmd"
-if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
- rm -f "${HOME}/Steam/appcache/appinfo.vdf"
-fi
-availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
-if [ -z "${availablebuild}" ]; then
- fn_print_fail "Checking for update: SteamCMD"
- fn_scriptlog "Failure! Checking for update: SteamCMD"
- sleep 1
- fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info"
- fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
- exit 1
-else
- fn_print_ok "Checking for update: SteamCMD"
- fn_scriptlog "Success! Checking for update: SteamCMD"
- sleep 1
-fi
+ # Gets availablebuild info
+ cd "${rootdir}/steamcmd"
+ if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
+ rm -f "${HOME}/Steam/appcache/appinfo.vdf"
+ fi
+ availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
+ if [ -z "${availablebuild}" ]; then
+ fn_print_fail "Checking for update: SteamCMD"
+ fn_scriptlog "Failure! Checking for update: SteamCMD"
+ sleep 1
+ fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info"
+ fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
+ exit 1
+ else
+ fn_print_ok "Checking for update: SteamCMD"
+ fn_scriptlog "Success! Checking for update: SteamCMD"
+ sleep 1
+ fi
-if [ "${currentbuild}" != "${availablebuild}" ]; then
- echo -e "\n"
- echo -e "Update available:"
- sleep 1
- echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m"
- echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m"
- echo -e ""
- echo -e " https://steamdb.info/app/${appid}/"
- sleep 1
- echo ""
- echo -en "Applying update.\r"
- sleep 1
- echo -en "Applying update..\r"
- sleep 1
- echo -en "Applying update...\r"
- sleep 1
- echo -en "\n"
- fn_scriptlog "Update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
- fn_scriptlog "${currentbuild} > ${availablebuild}"
+ if [ "${currentbuild}" != "${availablebuild}" ]; then
+ echo -e "\n"
+ echo -e "Update available:"
+ sleep 1
+ echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m"
+ echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e ""
+ echo -e " https://steamdb.info/app/${appid}/"
+ sleep 1
+ echo ""
+ echo -en "Applying update.\r"
+ sleep 1
+ echo -en "Applying update..\r"
+ sleep 1
+ echo -en "Applying update...\r"
+ sleep 1
+ echo -en "\n"
+ fn_scriptlog "Update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fn_scriptlog "${currentbuild} > ${availablebuild}"
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- unset updateonstart
- if [ "${tmuxwc}" -eq 1 ]; then
- command_stop.sh
- update_dl.sh
- command_start.sh
+ unset updateonstart
+ info_status.sh
+ if [ "${status}" != "0" ]; then
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ else
+ update_dl.sh
+ fi
else
- update_dl.sh
+ echo -e "\n"
+ echo -e "No update available:"
+ echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
+ echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e " https://steamdb.info/app/${appid}/"
+ echo -e ""
+ fn_print_ok_nl "No update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
fi
-else
- echo -e "\n"
- echo -e "No update available:"
- echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
- echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
- echo -e " https://steamdb.info/app/${appid}/"
- echo -e ""
- fn_print_ok_nl "No update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
-fi
}
### END SteamCMD Update Checker ###
fn_teamspeak3_check(){
-# Checks for server update from teamspeak.com using a mirror dl.4players.de
-fn_print_dots "Checking for update: teamspeak.com"
-fn_scriptlog "Checking for update: teamspeak.com"
-sleep 1
-
-# Gets currentbuild info
-# Checks currentbuild info is available, if fails a server restart will be forced to generate logs
-if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
- fn_print_fail "Checking for update: teamspeak.com"
+ # Checks for server update from teamspeak.com using a mirror dl.4players.de
+ fn_print_dots "Checking for update: teamspeak.com"
+ fn_scriptlog "Checking for update: teamspeak.com"
sleep 1
- fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
- sleep 2
- fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart"
- fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
- sleep 2
- command_stop.sh
- command_start.sh
- sleep 2
- # If still failing will exit
+
+ # Gets currentbuild info
+ # Checks currentbuild info is available, if fails a server restart will be forced to generate logs
if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
- fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
- exit 1
+ fn_print_fail "Checking for update: teamspeak.com"
+ sleep 1
+ fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
+ sleep 2
+ fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart"
+ fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
+ sleep 2
+ command_stop.sh
+ command_start.sh
+ sleep 2
+ # If still failing will exit
+ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
+ fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
+ exit 1
+ fi
fi
-fi
-currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
+ currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
-# Gets the teamspeak server architecture
-info_distro.sh
-if [ "${arch}" == "x86_64" ]; then
- ts3arch="amd64"
-elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
- ts3arch="x86"
-else
- echo ""
- fn_print_failure "${arch} is an unsupported architecture"
- exit 1
-fi
-
-# Gets availablebuild info
+ # Gets the teamspeak server architecture
+ info_distro.sh
+ if [ "${arch}" == "x86_64" ]; then
+ ts3arch="amd64"
+ elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
+ ts3arch="x86"
+ else
+ echo ""
+ fn_print_failure "${arch} is an unsupported architecture"
+ exit 1
+ fi
+
+ # Gets availablebuild info
-# Grabs all version numbers but not in correct order
-wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp
+ # Grabs all version numbers but not in correct order
+ wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp
-# Sort version numbers
-cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp
+ # Sort version numbers
+ cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp
-# Finds directory with most recent server version.
-while read ts3_version_number; do
- wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
- if [ $? -eq 0 ]; then
- availablebuild="${ts3_version_number}"
- # Break while-loop, if the latest release could be found
- break
- fi
-done < .ts3_version_numbers_sorted.tmp
+ # Finds directory with most recent server version.
+ while read ts3_version_number; do
+ wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
+ if [ $? -eq 0 ]; then
+ availablebuild="${ts3_version_number}"
+ # Break while-loop, if the latest release could be found
+ break
+ fi
+ done < .ts3_version_numbers_sorted.tmp
-# Tidy up
-rm -f ".ts3_version_numbers_unsorted.tmp"
-rm -f ".ts3_version_numbers_sorted.tmp"
+ # Tidy up
+ rm -f ".ts3_version_numbers_unsorted.tmp"
+ rm -f ".ts3_version_numbers_sorted.tmp"
-# Checks availablebuild info is available
-if [ -z "${availablebuild}" ]; then
- fn_print_fail "Checking for update: teamspeak.com"
- fn_scriptlog "Checking for update: teamspeak.com"
- sleep 1
- fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
- fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
- sleep 2
- exit 1
-else
- fn_print_ok "Checking for update: teamspeak.com"
- fn_scriptlog "Success! Checking for update: teamspeak.com"
- sleep 1
-fi
+ # Checks availablebuild info is available
+ if [ -z "${availablebuild}" ]; then
+ fn_print_fail "Checking for update: teamspeak.com"
+ fn_scriptlog "Checking for update: teamspeak.com"
+ sleep 1
+ fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
+ fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
+ sleep 2
+ exit 1
+ else
+ fn_print_ok "Checking for update: teamspeak.com"
+ fn_scriptlog "Success! Checking for update: teamspeak.com"
+ sleep 1
+ fi
-# Removes dots so if can compare version numbers
-currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
-availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
-if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
- echo -e "\n"
- echo -e "Update available:"
- sleep 1
- echo -e " Current build: \e[0;31m${currentbuild} ${architecture}\e[0;39m"
- echo -e " Available build: \e[0;32m${availablebuild} ${architecture}\e[0;39m"
- echo -e ""
- sleep 1
- echo ""
- echo -en "Applying update.\r"
- sleep 1
- echo -en "Applying update..\r"
- sleep 1
- echo -en "Applying update...\r"
- sleep 1
- echo -en "\n"
- fn_scriptlog "Update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
- fn_scriptlog "${currentbuild} > ${availablebuild}"
- unset updateonstart
- info_ts3status.sh
- if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
- update_dl.sh
- command_start.sh
- sleep 5
- command_stop.sh
+ # Removes dots so if can compare version numbers
+ currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
+ availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]')
+ if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then
+ echo -e "\n"
+ echo -e "Update available:"
+ sleep 1
+ echo -e " Current build: \e[0;31m${currentbuild} ${architecture}\e[0;39m"
+ echo -e " Available build: \e[0;32m${availablebuild} ${architecture}\e[0;39m"
+ echo -e ""
+ sleep 1
+ echo ""
+ echo -en "Applying update.\r"
+ sleep 1
+ echo -en "Applying update..\r"
+ sleep 1
+ echo -en "Applying update...\r"
+ sleep 1
+ echo -en "\n"
+ fn_scriptlog "Update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
+ fn_scriptlog "${currentbuild} > ${availablebuild}"
+
+ unset updateonstart
+ check_status.sh
+ if [ "${status}" == "0" ]; then
+ update_dl.sh
+ command_start.sh
+ sleep 5
+ command_stop.sh
+ else
+ command_stop.sh
+ update_dl.sh
+ command_start.sh
+ fi
else
- command_stop.sh
- update_dl.sh
- command_start.sh
+ echo -e "\n"
+ echo -e "No update available:"
+ echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
+ echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
+ echo -e ""
+ fn_print_ok_nl "No update available"
+ fn_scriptlog "Current build: ${currentbuild}"
+ fn_scriptlog "Available build: ${availablebuild}"
fi
-else
- echo -e "\n"
- echo -e "No update available:"
- echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
- echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
- echo -e ""
- fn_print_ok_nl "No update available"
- fn_scriptlog "Current build: ${currentbuild}"
- fn_scriptlog "Available build: ${availablebuild}"
-fi
}
check.sh
@@ -312,8 +314,7 @@ if [ "${gamename}" == "Teamspeak 3" ]; then
elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then
# Goldsource servers bypass checks as fn_steamcmdcheck does not work for appid 90 servers.
# forceupdate bypasses checks
- tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
- if [ "${tmuxwc}" -eq 1 ]; then
+ if [ "${status}" != "0" ]; then
command_stop.sh
update_dl.sh
command_start.sh