diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index 232bf9f1e..db353be3d 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -17,8 +17,8 @@ fn_stop_graceful_source(){ tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1 # waits up to 30 seconds giving the server time to shutdown gracefuly for seconds in {1..30}; do - pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") - if [ "${pid}" == "0" ]; then + check_status.sh + if [ "${status}" != "0" ]; then fn_print_ok "Graceful: rcon quit: ${seconds}: " fn_print_ok_eol_nl fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds" @@ -27,7 +27,8 @@ fn_stop_graceful_source(){ sleep 1 fn_print_dots "Graceful: rcon quit: ${seconds}" done - if [ "${pid}" != "0" ]; then + check_status.sh + if [ "${status}" != "0" ]; then fn_print_fail "Graceful: rcon quit: " fn_print_fail_eol_nl fn_scriptlog "Graceful: rcon quit: FAIL" @@ -176,8 +177,8 @@ fn_stop_teamspeak3(){ # Kill tmux session tmux kill-session -t "${servicename}" > /dev/null 2>&1 sleep 0.5 - pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") - if [ "${pid}" == "0" ]; then + check_status.sh + if [ "${status}" == "0" ]; then # Remove lock file rm -f "${rootdir}/${lockselfname}" fn_print_ok_nl "${servername}" @@ -199,8 +200,8 @@ fn_stop_pre_check(){ fn_stop_teamspeak3 fi else - pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") - if [ "${pid}" == "0" ]; then + check_status.sh + if [ "${status}" != "0" ]; then fn_print_ok_nl "${servername} is already stopped" fn_scriptlog "${servername} is already stopped" else