The documentation for the Software Gateway is incomplete. It shows how to configure the gateway with the setup.sh script, but does not show how to set up the gateway as a service or start the gateway process to have it listen for connections.
Need a document to configure gateway as a service upon installation.
Release : 10.1
Component : API GATEWAY
Run Software Gateway as SystemD Service in Linux
Systemd is a software application that provides an array of system components for Linux operating systems. It is the first service to initialize the boot sequence. This always runs with pid 1. This also helps use to manage system and application service on our Linux operating system.
+x /usr/bin/script.sh
To run a script once during system boot time doesn’t required any infinite loop. Instead you can use your shell script to run as Systemd service. Below assume login as the root user in the server.
Create a service file for the systemd on your system. This file must have .service extension and saved under the /lib/systemd/system/ directory
Then, add the following content and update the script filename and location. You can also change the description of the service.
[Unit]
Description=Sample SSG Shell Script
[Service]
WorkingDirectory=/opt/SecureSpan/Gateway/runtime/bin/
ExecStart=/opt/SecureSpan/Gateway/runtime/bin/gateway.sh start
User=<UserName>
Group=<group of userName>
Type=forking
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Say the service file created is called ssg.service
The system service has been added to your service. Reload the systemctl daemon to read new file. You need to reload this daemon each time after making any changes in .service file.
>systemctl daemon-reload
Now enable the service to start on system boot, also start the service using the following commands.
> systemctl enable ssg.service
> systemctl start ssg.service
Finally verify the script is up and running as a systemd service.
> systemctl status ssg.service
or
> service ssg status
Note: Due to timing of the script's execution, the java process may fail to start when it check the process pid file which is need to moved to other directory.
A sleep command is needed in processcontroller.sh to resolve the problem (attachment line 96).
The modified the processcontroller.sh is attached.