Running Kaspersky Scan Engine in ICAP mode with the init script
You can run Kaspersky Scan Engine in ICAP mode by using the kavicapd
service init script located in the %service_dir%/etc/init.d
directory. The init script allows you to run the service manually from the command line or add it as a startup script.
Preparing the init script
By default, the kavicapd
init script searches for the kavicapd
executable file in the /opt/kaspersky/ScanEngine/bin
directory. If you want to use the kavicapd service from another location, edit the init script accordingly. The DAEMON_DIR
variable in the kavicapd
script defines the path to the kavicapd executable file.
To prepare the kavicapd init script:
- Open the
kavicapd.sh
script for editing. - Specify paths to plugins and libraries.
- Locate the following code:
########## ICAP service configuration ##########
DAEMON_DIR="${SDKPATH}/bin"
DAEMON="${DAEMON_DIR}/kavicapd"
PIDFILE=/var/run/kavicapd.pid
CONFILE=/etc/kavicapd.xml
- If required, manually set the value of the
DAEMON_DIR
variable to thekavicapd
executable file location. - Set the value of the
PIDFILE
variable to thekavicapd
PID file location.If the PID file does not exist, the process initiated by the
kavicapd.sh
script will create it. - Set the value of the
CONFILE
variable to the ICAP mode configuration file location. - Locate the following line:
STATUS_FILE_PATH=/tmp/kavicapd
- Set the value of the
STATUS_FILE_PATH
variable to the directory that will contain the status file of thekavicapd
service.The value of this variable must be the same as the value of
TempPath
in the ICAP mode configuration file. - Locate the following line:
UPDATE_SIGNAL="USR1"
- Set the value of the
UPDATE_SIGNAL
variable to the signal that will be used to update and reload the database (updatedb
command).Specify
USR1
to useSIGUSR1
, orUSR2
to useSIGUSR2
.If the
kavicapd
service receives aUSR
signal (SIGUSR1
orSIGUSR2
) that is not specified in this parameter, the service stops (this is the default behavior of Linux programs). Consider this behavior when specifying a value for this parameter. - Save the file and close the editor.
Running the service with the init script
The kavicapd.sh init script supports the following commands:
start
—Start thekavicapd
service.After this command is executed, the script prints
[OK]
and immediately returns control to the terminal, but it takes the service some time to start.stop
—Stop thekavicapd
service.restart
—Restart thekavicapd
service (that is, stop and then start the service).After this command is executed, the script prints
[OK]
and immediately returns control to the terminal, but it takes the service some time to start.updatedb
—Send aSIGUSR1
orSIGUSR2
signal (as specified in theUPDATE_SIGNAL
parameter of the init script) to thekavicapd
service.The
kavicapd
service handles this signal either by reloading or by updating and then reloading the database, as specified in the ICAP mode configuration file.status
—Show the status of thekavicapd
service.Status message contains the following information:
- KAV SDK version
- ICAP version
- Information about the anti-virus database
- Information about the key file or activation code
Following is an example of the
status
command output in simplified licensing mode:kavicapd (pid 1107) is running...
KAV SDK version: KAV SDK v8.5.1.83
ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)
Database release date: 2015-Sep-14 07:46:00
Records in the database: 4308101
Key file name: EXAMPLE.key
Key file expiration date: 2019-Jan-12 20:00:00
Days left: 590
Following is an example of the
status
command output in online licensing mode.kavicapd (pid 1107) is running...
KAV SDK version: KAV SDK v8.5.1.83
ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)
Database release date: 2015-Sep-14 07:46:00
Records in the database: 4308101
Activation code: EXMPL-*****-*****-12345
License expiration date: 2019-Jan-12 20:00:00
Days left: 590
To see the list of supported commands, execute the script without any parameters.
[user@host ~]$ /etc/init.d/kavicapd |
Running the service automatically
To start the service automatically, make kavicapd
a startup service.
To make kavicapd a startup service:
- Copy the kavicapd.sh init script to the directory that contains init scripts. The location of this directory may vary depending on the operating system.
- Add the
kavicapd
service to the service startup list. The exact method may vary depending on the operating system. - Verify that the service has been added successfully.
- Restart the system for the changes to take effect.