Arma3: improve exit handling for headless clients (#476)
This commit is contained in:
		@@ -38,13 +38,14 @@ for i in $(seq 1 "$1"); do
 | 
				
			|||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Monitor server process and terminate headless clients
 | 
					# Monitor server process and terminate headless clients
 | 
				
			||||||
# when server terminates
 | 
					# when server terminates or SIGTERM/SIGINT received
 | 
				
			||||||
trap 'kill "${clients[@]}" >/dev/null 2>&1' SIGTERM
 | 
					trap 'for client in "${clients[@]}"; do kill "$client" >/dev/null 2>&1; done; wait' SIGTERM SIGINT
 | 
				
			||||||
while true; do
 | 
					while true; do
 | 
				
			||||||
  if ! $netcommand -uln | grep -q ":$3 "; then
 | 
					  if ! $netcommand -uln | grep -q ":$3 "; then
 | 
				
			||||||
    for client in "${clients[@]}"; do
 | 
					    for client in "${clients[@]}"; do
 | 
				
			||||||
      kill "$client" >/dev/null 2>&1
 | 
					      kill "$client" >/dev/null 2>&1
 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
 | 
					    wait
 | 
				
			||||||
    exit 0
 | 
					    exit 0
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  sleep 1
 | 
					  sleep 1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user