Create a XPLG service via Systemctl

Another utility which is common for automation of services in Linux is the systemctl.

Systemctl allows users and Linux administrators fully control and automatons of Linux services, deals with machine restarts and responses of the service after unexpected crashes.

In order to create XPLG service via this utility, please follow:

1) install and run XPLG as root user
2) vi /etc/systemd/system/XPLG.service

3) Set the XPLG.service file contents to:

[Unit]
Description=XPLG Service
After=network-online.target

[Service]
Type=forking
NotifyAccess=main
User=root
ExecStart=/PATH_TO_XPLG_INSTALL_DIR/runXpoLog.sh start
Restart=always

[Install]
WantedBy=multi-user.target

4) Grant execution permission to the service file - chmod +x /etc/systemd/system/XPLG.service
5) Update the OS regarding the new service - systemctl enable XPLG
6) systemctl daemon-reload

- Kill XPLG (it will automatically start)
- From this point on:
systemctl start XPLG
systemctl stop XPLG

- Change /PATH_TO_XPLG_INSTALL_DIR/restart.sh (In order to deal with the daily recycle of XPLG):

#!/bin/sh
DIR=`dirname $0`

nohup sh $DIR/runXpoLog.sh stop