From e25db46969df5b5bb9576090ef2158a7d428ce86 Mon Sep 17 00:00:00 2001 From: LanderOtto Date: Thu, 11 Sep 2025 18:07:41 +0200 Subject: [PATCH] Fix signal sending to Capio server for proper termination --- capio-run/capiorun | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/capio-run/capiorun b/capio-run/capiorun index 44291b839..8db66c97d 100755 --- a/capio-run/capiorun +++ b/capio-run/capiorun @@ -158,8 +158,6 @@ if __name__ == "__main__": ), ], env=server_env, - stdout="server.log", - stderr="server.err", cwd=args.log_dir, start_new_session=True, ) @@ -198,23 +196,24 @@ if __name__ == "__main__": f"An error occurred in startup/execution of workflow app <{args.app_name}>: {e}" ) + num_server_files = 6 if server_process is not None: - if count_files_starting_with(workflow_name) >= 4: + if count_files_starting_with(workflow_name) >= num_server_files: print( "Server instance is used by other applications... skipping server termination" ) else: print(f"Terminating instance of capio_server") - server_process.send_signal(signal.SIGTERM) + server_process.send_signal(signal.SIGUSR1) time.sleep(2) print("Terminated CAPIO server instance") else: - if count_files_starting_with(workflow_name) < 4: + if count_files_starting_with(workflow_name) < num_server_files: print( "Terminating instance of capio_server started by other capiorun command" ) result = subprocess.run( - ["killall", "capio_server"], stdout=sys.stdout, stderr=sys.stderr + ["killall","-USR1", "capio_server"], stdout=sys.stdout, stderr=sys.stderr ) if result.returncode == 0: print("Terminated CAPIO server instance")