Просмотр исходного кода

Fixed tmux sessions killed when they should not

When graceful works, probably because of pipe-pane or for whatever reason, the tmux session dies. But fn_stop_tmux was ran anyways, which then caused a command like
tmux kill-session -t csgoserver 
to affect the closest matching alternate, like csgoserver-2 tmux session.
With this change, we make sure to run the session kill only when required.
UltimateByte 8 лет назад
Родитель
Сommit
97c87a9d56
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      lgsm/functions/command_stop.sh

+ 5 - 6
lgsm/functions/command_stop.sh

@@ -34,7 +34,6 @@ fn_stop_graceful_ctrlc(){
 		fn_script_log_error "Graceful: CTRL+c: FAIL"
 	fi
 	sleep 0.5
-	fn_stop_tmux
 }
 
 # Attempts graceful shutdown by sending a specified command.
@@ -64,7 +63,6 @@ fn_stop_graceful_cmd(){
 		fn_script_log_error "Graceful: sending \"${1}\": FAIL"
 	fi
 	sleep 0.5
-	fn_stop_tmux
 }
 
 # Attempts graceful of goldsource using rcon 'quit' command.
@@ -85,7 +83,6 @@ fn_stop_graceful_goldsource(){
 	fn_print_ok_eol_nl
 	fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
 	sleep 0.5
-	fn_stop_tmux
 }
 
 # Attempts graceful of 7 Days To Die using telnet.
@@ -174,7 +171,6 @@ fn_stop_graceful_sdtd(){
 		fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
 	fi
 	sleep 0.5
-	fn_stop_tmux
 }
 
 fn_stop_graceful_select(){
@@ -195,8 +191,6 @@ fn_stop_graceful_select(){
 		fn_stop_graceful_ctrlc
 	elif  [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]||[ "${engine}" == "projectzomboid" ]||[ "${shortname}" == "rw" ]; then
 		fn_stop_graceful_cmd "quit" 30
-	else
-		fn_stop_tmux
 	fi
 }
 
@@ -293,6 +287,11 @@ fn_stop_pre_check(){
 	else
 		fn_stop_graceful_select
 	fi
+	# Check status again, a stop tmux session if needed
+	check_status.sh
+	if [ "${status}" != "0" ]; then
+		fn_stop_tmux
+	fi
 }
 
 fn_print_dots "${servername}"