This repository provides a kdb library to integrate with systemd
. It provides the following features:
- Support for
Type=Notify
systemd services, providing READY and STOPPING signals - Support for
WatchdogSec=
systemd watchdog monitoring- NOTE: This requires the kdb+ process to be the main process started by systemd. Use
exec
instead of backgrounding a process
- NOTE: This requires the kdb+ process to be the main process started by systemd. Use
An example systemd service file is provided in the repository.
NOTE: This library requires the shared object libkdbsystemd.so
provided by the kdb-systemd-lib repository. Please ensure that this object is available in your target environment and it's location referenced in LD_LIBRARY_PATH
.
This library has been written for use with the kdb-common set of libraries.
See kdb-systemd-lib for build instructions
When the library is loaded and .sdi.init
is executed (see kdb-common require.q for more details), the following initialisation is performed:
- Attempt to discover the find the required shared object (
libkdbsystemd.so
) withinLD_LIBRARY_PATH
- The systemd interface functions are loaded from the shared object into the
.sdi.so
namespace
This function should be called after the process initialistion phases is complete and you want to report back to systemd that the process is ready for use. This function also:
- Configures the systemd watchdog (i.e. heartbeat) if configured in the systemd file (using the kdb-common cron.q library)
- Configures notifying systemd when the process is about to exit (using the kdb-common event.q library)
This function allows you to send custom status strings to systemd for more detailed reporting.
Example:
q) .sdi.sendStatus "Status from kdb+"
> systemctl status kdb-service
Active: active (running) since Fri 2019-07-05 13:48:33 BST; 29s ago
Main PID: 8801 (q)
Status: "Status from kdb+"