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:
kavicapd.sh script for editing./etc/init.d/kavicapd.########## ICAP service configuration ########## DAEMON_DIR="${SDKPATH}/bin" DAEMON="${DAEMON_DIR}/kavicapd" PIDFILE=/var/run/kavicapd.pid CONFILE=/etc/kavicapd.xml |
DAEMON_DIR variable to the kavicapd executable file location.PIDFILE variable to the kavicapd PID file location.If the PID file does not exist, the process initiated by the kavicapd.sh script will create it.
CONFILE variable to the ICAP mode configuration file location.STATUS_FILE_PATH=/tmp/kavicapd
STATUS_FILE_PATH variable to the directory that will contain the status file of the kavicapd service. The value of this variable must be the same as the value of TempPath in the ICAP mode configuration file.
UPDATE_SIGNAL="USR1" |
UPDATE_SIGNAL variable to the signal that will be used to update and reload the database (updatedb command).Specify USR1 to use SIGUSR1, or USR2 to use SIGUSR2.
If the kavicapd service receives a USR signal (SIGUSR1 or SIGUSR2) 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.
REOPEN_LOG_SIGNAL="USR2" |
Running the service with the init script
The kavicapd.sh init script supports the following commands:
start—Start the kavicapd 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 the kavicapd service.restart—Restart the kavicapd 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—Update and reload antivirus databases by sending the SIGUSR1 signal to the kavicapd service. You can change the action that is performed when the signal is received. To do this, change the value of the USR1SignalAction and USR2SignalAction parameters in the kavicapd.xml configuration file. For more information, see section "ICAP mode configuration file". You also can change the signal. To do this, specify another value at the UPDATE_SIGNAL variable in the init script.reopen-log—Reopen log files in syslog format to write logs at the end of these files. This is accomplished by sending the SIGUSR2 signal to the kavicapd service. This setting allows to rotate the logs using the logrotate utility in default mode or when the create directive is used. You can change the action which performed on receiving the signal. To do this, change the value of the USR1SignalAction and USR2SignalAction parameters in the kavicapd.xml configuration file. For more information, see section "ICAP mode configuration file". You also can change the signal. To do this, specify another value at the REOPEN_LOG_SIGNAL variable in the init script.status—Show the status of the kavicapd service.Status message contains the following information:
Following is an example of the status command output in simplified licensing mode:
|
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: