EDA Solutions logo

Licensing as a service (systemd) on Linux

Published by Henry Frankland – Latest update: 25/02/2022

ID: TN028
Relevant product(s): Flexnet
Operating systems: RHEL 7/8
Versions affected: All
Relevant area(s): Licensing

Summary

FlexNet on Linux can simply be executed as an application, this method is described here. However there is an alternative method in which the necessary executables can be run as a service, which has some advantages over running as an application.

When a license server goes down for whatever reason it is handy if the license server service came up automatically on restart. The Default Flexnet Licensing installation does not require any special consideration and can placed anywhere and started in many different ways.

Details

Place the Flexnet licensing software, license files and setup scripts for this service under the /opt directory. The /opt directory is a dedicated third party software directory in Linux. The resulting structure should be similar to:

“9-23_5-6-0.aol” is a directory containing the licensing binaries (LMGRD, MGCLD…etc).

Configure the “mentor-flex-srv.sh” (or your equivalent) to contain all the normal environment variables and license execution commands you normally need to make the license software run. The name of the bash script is arbitrary and can be changed. Below is a snapshot of what “mentor-flex-srv.sh” contains:

export LM_LICENSE_FILE=/opt/licensing/siemens/flexnet/license_files/SERVER.txt
export MGLS_HOME=/opt/licensing/siemens/flexnet/9-23_5-6-0.aol
export PATH=${PATH}:${MGLS_HOME}/bin
export LM_LICENSE_LOG=/opt/licensing/siemens/flexnet/license_files/SERVER_LOG.txt

echo mgls home ${MGLS_HOME}
echo license file ${LM_LICENSE_FILE}
echo log loc ${LM_LICENSE_LOG}

lmgrd -l ${LM_LICENSE_LOG}

The first four lines are all standard environment variables for getting the Mentor License Tools from Siemens running. The “echo” commands will be shown in the systemctl status command log section when querying the service on Linux. The last line is the command to launch the license server.

The next step is to define the service file under the standard service directory with a name “<name>.service”. The service file provides the service information:

/etc/systemd/system/

Create a blank file under the above directory using your favourite editor. In this example, we will call it “mentlic.service”:

/etc/systemd/system/mentlic.service

The contents of the file are:

[Unit]
Description=mentor licensing service
After=network.target

[Service]
Type=forking
ExecStart=/opt/licensing/siemens/flexnet/ment-flex-srv.sh
TimeoutStartSec=0

[Install]
WantedBy=default.target

The above entries can be understood by referring to the RHEL user manual for systemd here for their description.

Once this file is saved, start the service using the daemon-reload and start the service:

sudo systemctl daemon-reload
sudo systemctl start mentlic.service

To enable the service, use the systemctl enable command:

sudo systemctl enable mentlic.service

References

RHEL systemd documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/chap-managing_services_with_systemd

Siemens Digital Industries Software Licensing Manual for Mentor® Products: https://docs.sw.siemens.com/en-US/product/852852103/doc/DC202112090.docs.sw_siemens_licensing_mgc.en_us/pdf/?audience=external