Services - Unix systems
The following describes how to set up Karaf and OpenSearch as a systemd Service.
Preparation
-
Create the subdirectory
systemdin the BPC installation directory and change to it -
From Download - Virtimo Fileserver, place the following scripts and templates in this directory:
-
opensearch-systemd-generate.sh -
opensearch-systemd.template -
karaf-systemd-generate.sh -
karaf-systemd.template
-
-
Make the two scripts executable
-
chmod +x opensearch-systemd-generate.sh -
chmod +x karaf-systemd-generate.sh
-
Generate systemd scripts (once)
We generate these for Karaf and OpenSearch. For both generation scripts, you can get a list of the available parameters by calling them without or with the '-h' parameter .
$ ./opensearch-systemd-generate.sh -k /INSTALLATIONSVERZEICHNIS/bpc/opensearch -j /INSTALLATIONSVERZEICHNIS/bpc/_jvm -n bpc-opensearch -u bpc -g bpc
$ ./karaf-systemd-generate.sh -k /INSTALLATION-DIRECTORY/bpc/karaf -j /INSTALLATION-DIRECTORY/bpc/_jvm -n bpc-karaf -u bpc -g bpc -a bpc-opensearch.service
This generates the systemd scripts bpc-opensearch.service and bpc-karaf.service in the same directory.
Parameters used
- k
-
Installation directory of the application (mandatory)
- j
-
Java home directory (mandatory)
- n
-
Service name
- a
-
Start after this service. The name of the OpenSearch service should be specified here. (Karaf only)
- u
-
Service user
- g
-
Service group
Set up systemd Service (one-time)
$ sudo systemctl enable /INSTALLATIONSVERZEICHNIS/bpc/systemd/bpc-opensearch.service
$ sudo systemctl enable /INSTALLATIONSVERZEICHNIS/bpc/systemd/bpc-karaf.service
Check
$ systemctl --type=service -a | grep -i bpc
UNIT LOAD ACTIVE SUB DESCRIPTION
bpc-opensearch.service loaded inactive dead OpenSearch - bpc-opensearch
bpc-karaf.service loaded inactive dead Karaf - bpc-karaf
Remove services
$ sudo systemctl disable bpc-opensearch.service
$ sudo systemctl disable bpc-karaf.service