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
 | 
			
		||||
 | 
			
		||||
# Monitor server process and terminate headless clients
 | 
			
		||||
# when server terminates
 | 
			
		||||
trap 'kill "${clients[@]}" >/dev/null 2>&1' SIGTERM
 | 
			
		||||
# when server terminates or SIGTERM/SIGINT received
 | 
			
		||||
trap 'for client in "${clients[@]}"; do kill "$client" >/dev/null 2>&1; done; wait' SIGTERM SIGINT
 | 
			
		||||
while true; do
 | 
			
		||||
  if ! $netcommand -uln | grep -q ":$3 "; then
 | 
			
		||||
    for client in "${clients[@]}"; do
 | 
			
		||||
      kill "$client" >/dev/null 2>&1
 | 
			
		||||
    done
 | 
			
		||||
    wait
 | 
			
		||||
    exit 0
 | 
			
		||||
  fi
 | 
			
		||||
  sleep 1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user