Daniel Gibbs 10 лет назад
Родитель
Сommit
50bf63da60
1 измененных файлов с 8 добавлено и 7 удалено
  1. 8 7
      lgsm/functions/command_stop.sh

+ 8 - 7
lgsm/functions/command_stop.sh

@@ -17,8 +17,8 @@ fn_stop_graceful_source(){
 	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
 	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
 	# waits up to 30 seconds giving the server time to shutdown gracefuly
 	# waits up to 30 seconds giving the server time to shutdown gracefuly
 	for seconds in {1..30}; do
 	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 "Graceful: rcon quit: ${seconds}: "
 			fn_print_ok_eol_nl
 			fn_print_ok_eol_nl
 			fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
 			fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
@@ -27,7 +27,8 @@ fn_stop_graceful_source(){
 		sleep 1
 		sleep 1
 		fn_print_dots "Graceful: rcon quit: ${seconds}"
 		fn_print_dots "Graceful: rcon quit: ${seconds}"
 	done
 	done
-	if [ "${pid}" != "0" ]; then
+	check_status.sh
+	if [ "${status}" != "0" ]; then
 		fn_print_fail "Graceful: rcon quit: "
 		fn_print_fail "Graceful: rcon quit: "
 		fn_print_fail_eol_nl
 		fn_print_fail_eol_nl
 		fn_scriptlog "Graceful: rcon quit: FAIL"
 		fn_scriptlog "Graceful: rcon quit: FAIL"
@@ -176,8 +177,8 @@ fn_stop_teamspeak3(){
 	# Kill tmux session
 	# Kill tmux session
 	tmux kill-session -t "${servicename}" > /dev/null 2>&1
 	tmux kill-session -t "${servicename}" > /dev/null 2>&1
 	sleep 0.5
 	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
 		# Remove lock file
 		rm -f "${rootdir}/${lockselfname}"
 		rm -f "${rootdir}/${lockselfname}"
 		fn_print_ok_nl "${servername}"
 		fn_print_ok_nl "${servername}"
@@ -199,8 +200,8 @@ fn_stop_pre_check(){
 			fn_stop_teamspeak3
 			fn_stop_teamspeak3
 		fi      
 		fi      
 	else
 	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_print_ok_nl "${servername} is already stopped"
 			fn_scriptlog "${servername} is already stopped"
 			fn_scriptlog "${servername} is already stopped"
 		else
 		else