Terminating the application in Standalone mode

Unlike Windows VCL on Linux there is no visual control panel to terminate the application server. Instead you can use one of the following methods.

  • If running in debug: press CTRL+F2 or choose Program Reset from the IDE Run menu. This forcefully terminates the application and does not allow cleanup procedures to run.

  • Use Linux tools to kill the process:

    • Use System Monitor to locate and kill the process. clip0191

    • Use the Linux command line kill to terminate the process.

To allow the server to terminate normally (so cleanup procedures run), enable the soTerminateOnSession option so the server stops automatically when the last session closes. To enable this, follow the steps below.

1

Enable the option in ServerModule

In the ServerModule component enable the soTerminateOnSession option.

clip0192

This makes the application terminate when all sessions are terminated (i.e., when the last session is closed). This simplifies debugging because you can just close active sessions instead of terminating the server manually.

2

Enable the option in code (optional)

You can enable the option programmatically in your UniGUIServerModuleBeforeInit event. Example:

ServerModule.pas
procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject);
begin
  .
  .
  .
  {$ifdef DEBUG}
  Options := Options + [soTerminateOnSession]; // terminate the app server when all sessions are closed. Only for debug mode
  {$endif}
end;

In this example the option is enabled only when compiled in DEBUG mode, so it will remain disabled in RELEASE builds for production.

3

Remotely terminate via Server Monitor

You can also shut down a standalone Linux64 application remotely from the Server Monitor:

  • In Server Monitor use the menu Manage -> Shutdown Server. This option is available only for standalone Linux64 applications. Selecting it will terminate the uniGUI server application.

clip0218
circle-exclamation

Note: The soTerminateOnSession option is not Linux-specific — it can be used on all supported platforms.