Browse Source

seporated tmux and ts3 code

Daniel Gibbs 10 years ago
parent
commit
660480187a
1 changed files with 13 additions and 10 deletions
  1. 13 10
      tests/tests_ts3server.sh

+ 13 - 10
tests/tests_ts3server.sh

@@ -70,15 +70,19 @@ fn_runfunction
 
 fn_functions
 
-fn_currentstatus(){
-if [ "${gamename}" == "Teamspeak 3" ]; then
-	fn_check_ts3status
-	ts3status=$(${executable} status servercfgfullpathfile=${servercfgfullpath})
+fn_currentstatus_tmux(){
+pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
+if [ "${pid}" != "0" ]; then
+	currentstatus="ONLINE"
 else
-	pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
+	currentstatus="OFFLINE"	
 fi
-echo "TS3STATUS: ${ts3status}"
-if [ "${pid}" != "0" ]||[ "${ts3status}" == "Server is running" ]; then
+}
+
+fn_currentstatus_ts3(){
+ts3status=$(${executable} status servercfgfullpathfile=${servercfgfullpath})
+
+if [ "${ts3status}" == "Server is running" ]; then
 	currentstatus="ONLINE"
 else
 	currentstatus="OFFLINE"	
@@ -86,15 +90,14 @@ fi
 }
 	
 fn_setstatus(){
-	fn_currentstatus
-	
+	fn_currentstatus_ts3
 	echo""
 	echo "Required status: ${requiredstatus}"
 	counter=0
 	echo "Current status:  ${currentstatus}"
     while [  "${requiredstatus}" != "${currentstatus}" ]; do
     	counter=$((counter+1))
-    	fn_currentstatus
+    	fn_currentstatus_ts3
 		echo -ne "New status:  ${currentstatus}\\r"
     	
 		if [ "${requiredstatus}" == "ONLINE" ]; then