Organizing service mode in Linux

To organize operating of the KAV SDK in the service mode, you need to perform the following successive steps:

  1. Open the kavehost service configuration file—kavehost.xml.

    By default, it is located at SDK_folder/etc. The SDK_folder here is the folder where the SDK package is extracted.

  2. Fill in the necessary parameters defining kavehost service properties.

    For more information, see section "Kavehost service configuration file".

  3. Specify correct environment variables the kavehost service init script.

    For more information, see section "Kavehost service init script".

  4. Start the kavehost service init script. The kavehost service is now running and waiting for the scanning tasks.
  5. Connect to the service by using the kaveInitializeService function.

After all scanning tasks are performed, you should call the kaveUninitialize function and stop the kavehost service.

Please use the SIGTERM system signal to terminate kavehost processes. Due to limitations of operating system, using SIGKILL or SIGSTOP signals to terminate kavehost processes is not recommended as it may leave zombie processes.

The following functions are not supported in the KAV_SHT_OUTPROC and KAV_SHT_SERVICE modes of KAV SDK:

The following functions are not supported in the KAV_SHT_SERVICE mode of KAV SDK:

Customizing service startup

The Kaspersky Anti-Virus Software Development Kit allows you to tailor kavehost service startup to ensure optimal fit-to-environment start conditions.

The following options are available for your use with the kavehost in the command line.

Kavehost server start options

Name

Description

-n

Enables the nodaemon mode for kavehost service. Specifying this option in the kavehost parameters forces the kavehost service to run in the foreground mode.

In this mode, the kavehost service does not detach from the terminal console once started and hence does not exit from the console. As a drawback, the kavehost does not return an exit code when exiting console. This renders it impossible for an external client process to check for this code and verify the server has successfully started.

If the -n switch is not specified, the kavehost service starts and immediately exits from the terminal console continuing to run in the background pretty much like with starting a command with ampersand (&) at the end.

Handling errors in service mode

When you work with KAV library as a service, errors occurred on the server side may be specifically handled by KAV client. For example, when the server side hosted by kavehost process ends unexpectedly, the client side of KAS library returns the KAV_S_R_NONSCANNED error code on every attempt scan an email following the termination of the kavehost host process.

In this section

Kavehost service configuration file

Kavehost service init script

Page top