Overview

This guide is to help us run IDHUB connector application as a service in any environment


Steps:

Following are the steps which needs to be followed in order to achieve connector application running as a part of the system service, and will also run automatically on each system reboot

Step1:

This step involves keeping the connector application into a desired folder

for example : we are keeping the connector configurations under Connector folder under apps
/apps/LDAP-Connector

Step2:

We need to have a LDAP-Connector.service file under like below
/etc/systemd/system/LDAP-Connector.service

Step3:

Setup LDAP-Connector.service file
To setup this below are the exact content which needs to be there



[Unit]

Description=IDHUB LDAP LINK Service

[Service]

User=root

# The configuration file application.properties should be here:

#change this to your workspace

WorkingDirectory=/apps/LDAP-Connector

#path to executable.

#executable is a bash script which calls jar file

#ExecStart=/apps/LDAP-connector/linker

Type=simple

ExecStart=/usr/bin/java -jar idhub-connector-application-1.0.0.jar

SuccessExitStatus=143

TimeoutStopSec=10

Restart=on-failure

RestartSec=5

[Install]

WantedBy=multi-user.target
BASH


There are basically 2 things which needs to be configured here:

  1. WorkingDirectory= <needs to be the directory location where the LDAP connector file is present >
  2. ExecStart= <.jar file can be changed accordingly as per the file inside LDAP connector folder>

Step4:

Execute the below commands in sequence:

  1. Reload the service files to include the new service.
    sudo systemctl daemon-reload

  2. Start your service
    sudo systemctl start your-service.service

  3. To check the status of your service
    sudo systemctl status example.service
  4. To enable your service on every reboot
    sudo systemctl enable example.service

  5. To disable your service on every reboot
    sudo systemctl disable example.service