Przeglądaj źródła

ts3server online status now works

Daniel Gibbs 11 lat temu
rodzic
commit
f494ca7084
3 zmienionych plików z 27 dodań i 10 usunięć
  1. 1 0
      functions/fn_check_logs
  2. 24 6
      functions/fn_details
  3. 2 4
      functions/fn_start

+ 1 - 0
functions/fn_check_logs

@@ -3,6 +3,7 @@
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
 # Version: 160215
+# Description: Checks that log files exist on server start
 
 # Create dir's for the script and console logs
 if [ ! -f "${scriptlog}" ]; then

+ 24 - 6
functions/fn_details

@@ -66,11 +66,21 @@ echo -e "\e[34mServer IP:£\e[0m${ip}:${port}" >> .fn_details_gameserver
 if [ ! -z "${rcon}" ]; then
 	echo -e "\e[34mRCON password:£\e[0m${rcon}" >> .fn_details_gameserver
 fi
-pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
-if [ "${pid}" == "0" ]; then
-        echo -e "\e[34mStatus:£\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver
+
+if [ "${gamename}" == "Teamspeak 3" ]; then
+	fn_check_ts3status
+	if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
+		echo -e "\e[34mStatus:£\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver
+	else
+		echo -e "\e[34mStatus:£\e[0;32mONLINE\e[0m" >> .fn_details_gameserver
+	fi
 else
-        echo -e "\e[34mStatus:£\e[0;32mONLINE\e[0m" >> .fn_details_gameserver
+	pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
+	if [ "${pid}" == "0" ]; then
+		echo -e "\e[34mStatus:£\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver
+	else
+		echo -e "\e[34mStatus:£\e[0;32mONLINE\e[0m" >> .fn_details_gameserver
+	fi
 fi
 column -s '£' -t .fn_details_gameserver
 rm -f .fn_details_gameserver
@@ -114,10 +124,18 @@ echo -e "${executable} ${parms}"
 
 fn_details_statusbottom(){
 echo -e ""
-if [ "${pid}" == "0" ]; then
+if [ "${gamename}" == "Teamspeak 3" ]; then
+	if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
         echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
+	else
+		echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
+	fi
 else
-        echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
+	if [ "${pid}" == "0" ]; then
+		echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
+	else
+		echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
+	fi
 fi
 echo -e ""
 }

+ 2 - 4
functions/fn_start

@@ -53,12 +53,10 @@ cd "${executabledir}"
 ./ts3server_startscript.sh start inifile=${servercfgfullpath} > /dev/null 2>&1
 sleep 1
 fn_check_ts3status
-#
 if [ "${ts3status}" = "Server seems to have died" ] || [ "${ts3status}"	= "No server running (ts3server.pid is missing)" ];then
 	fn_printfailnl "Unable to start ${servername}"
 	fn_scriptlog "Unable to start ${servername}"
-	echo -en "	Check log files: ${rootdir}/log"
-	echo -en "	Run debug mode: ./${selfname} debug"
+	echo -e "	Check log files: ${rootdir}/log"
 else
 	fn_printok "${servername}"
 	fn_scriptlog "Started ${servername}"
@@ -121,7 +119,7 @@ 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"
+	echo -e "	Check log files: ${rootdir}/log"
 	echo -en "	Run debug mode: ./${selfname} debug"
 	if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
 		fn_scriptlog "tmux returned the following error"