From 660480187a68d5db5cc4100172387a4b7631d0ad Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 7 Nov 2015 16:26:13 +0000 Subject: [PATCH] seporated tmux and ts3 code --- tests/tests_ts3server.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 756a9770e..1468ca4db 100644 --- a/tests/tests_ts3server.sh +++ b/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