|
@@ -70,15 +70,19 @@ fn_runfunction
|
|
|
|
|
|
|
|
fn_functions
|
|
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
|
|
else
|
|
|
- pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
|
|
|
|
|
|
|
+ currentstatus="OFFLINE"
|
|
|
fi
|
|
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"
|
|
currentstatus="ONLINE"
|
|
|
else
|
|
else
|
|
|
currentstatus="OFFLINE"
|
|
currentstatus="OFFLINE"
|
|
@@ -86,15 +90,14 @@ fi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fn_setstatus(){
|
|
fn_setstatus(){
|
|
|
- fn_currentstatus
|
|
|
|
|
-
|
|
|
|
|
|
|
+ fn_currentstatus_ts3
|
|
|
echo""
|
|
echo""
|
|
|
echo "Required status: ${requiredstatus}"
|
|
echo "Required status: ${requiredstatus}"
|
|
|
counter=0
|
|
counter=0
|
|
|
echo "Current status: ${currentstatus}"
|
|
echo "Current status: ${currentstatus}"
|
|
|
while [ "${requiredstatus}" != "${currentstatus}" ]; do
|
|
while [ "${requiredstatus}" != "${currentstatus}" ]; do
|
|
|
counter=$((counter+1))
|
|
counter=$((counter+1))
|
|
|
- fn_currentstatus
|
|
|
|
|
|
|
+ fn_currentstatus_ts3
|
|
|
echo -ne "New status: ${currentstatus}\\r"
|
|
echo -ne "New status: ${currentstatus}\\r"
|
|
|
|
|
|
|
|
if [ "${requiredstatus}" == "ONLINE" ]; then
|
|
if [ "${requiredstatus}" == "ONLINE" ]; then
|