Creating A System Service for systemd-based Linux Distros
Systemd
(System Daemon) is a system and service management mechanism primarily responsible for init processes (i.e. Assisting kernel with starting required services needed at machine bootup), and is the predecessor of SysVinit
.
Many modern-day Linux distributions have moved to using systemd
in place of init.d for system and service management, but there are still as many that are configured to utilize the legacy SysVinit
service manager.
As for IBM Automatic Data Lineage, with version R42.3 and newer, systemd
is used by
default. For older versions, see Steps for Creating MantaLauncher.service (R42 - R42.2) section.
Steps for Creating MantaLauncher.service
(R42.3 and newer):
Clean install
Clean install of Automatic Data Lineage R42.3 and newer works out of the box and if chosen to install Automatic Data Lineage as a service, the new systemd service will be created.
Upgrade
There are two ways how to upgrade Automatic Data Lineage installed as a service.
-
Run the upgrade as a root user
-
Run the upgrades as a non-root user and after the installation finishes, run the
<installdir>/launcher/bin/reinstall_service.sh
.
Possible issues with SELinux
In Linux distributions with SELinux (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-security-enhanced_linux-introduction ) enabled, the systemd services may fail to run, as executing scripts in home directories is disabled by default. There are two ways how to mitigate this problem:
-
Create a new SEL rule to allow the service to run
-
To do this, try to start MantaLauncher service and then follow the instructions on this page: 8.3.8. Allowing Access: audit2allow Red Hat Enterprise Linux 6 | Red Hat Customer Portal
- There may be multiple SEL exceptions that you will have to allow
-
-
Set SEL to permissive mode (not recommended)
If you are having an issue with creating a SEL rule to allow the service to run, you can try the following steps instead:
-
Switch SEL to permissive mode
-
Run the service
-
Verify the services were started
-
Shutdown the service
-
Switch SEL back to enforced mode
-
Try to start the service
Steps for Creating MantaLauncher.service
(R42 - R42.2):
As for Automatic Data Lineage, during installation when wanting to have MantaLauncher
installed as a system service so that the service starts automatically during boot-time, the Manta installer may attempt to configure the system service
via the SysVinit (init.d) manager, when the OS is actually using systemd, therefore may fail to create the system service. This is due to the way systemd compartmentalizes all of the various run-level services into different resource-based groupings,
in which, are defined by “unit” files which tell systemd what/when to do with each service/resource. This kind of behavior seems to be most commonly found on the latest RHEL-based Linux distros. If this is encountered, you may perform the following
steps to manually create and enable the
MantaLauncher
system service.
-
Stop the Manta services/applications if they are currently running
-
Move into the Launcher bin directory
cd <manta_install_dir>/launcher/bin
-
Edit both
startup.sh
andshutdown.sh
files, and at the top, ifSERVICE=false
, change toSERVICE=true
-
Download the service “unit” file
MantaLauncher.service
found below and update the following directive values under the[Service]
section to reflect your environment (Do not use quotations around the values) as per template below:Type=forking PIDFile=<manta_launcher_home>/manta-launcher-dir/data/launcher.pid ExecStart=<launcher_bin_dir>/startup.sh _os_startup ExecStop=<launcher_bin_dir>/shutdown.sh User=<manta_user> Group=<manta_user_group>
Example including full paths:
Type=forking PIDFile=/opt/mantaflow/launcher/manta-launcher-dir/data/launcher.pid ExecStart=/opt/mantaflow/launcher/bin/startup.sh _os_startup ExecStop=/opt/mantaflow/launcher/bin/shutdown.sh User=manta Group=users
-
After being updated and SCP’d/FPT’d onto the Automatic Data Lineage host machine, copy the file (As root user/privileges) into the
/usr/lib/systemd/system/
directorysudo cp ./MantaLauncher.service /usr/lib/systemd/system/
-
Run following command (Again, with root privileges) so the service starts during system boot:
sudo systemctl enable MantaLauncher.service
-
Lastly, you may test your work by starting the new system service with following command:
sudo systemctl start MantaLauncher.service
Commands to control the newly created MantaLauncher.service:
# To start the service
sudo systemctl start MantaLauncher.service
# To stop the service
sudo systemctl stop MantaLauncher.service
# To view current information/details for the service (Can be good to use for debugging if the service is failing to start/stop)
sudo systemctl status MantaLauncher.service
# This will disable the service from being started during bootup
sudo systemctl disable MantaLauncher.service