Skip to content

Instantly share code, notes, and snippets.

@kalebo
Created October 4, 2017 17:35
Show Gist options
  • Save kalebo/fd39edb6c6e4ebed41f7eab2d9925ebc to your computer and use it in GitHub Desktop.
Save kalebo/fd39edb6c6e4ebed41f7eab2d9925ebc to your computer and use it in GitHub Desktop.
Instructions on setting up a FlexLM daemon for SystemD

Setting up a FlexLM service for SystemD

Create directory structure

  1. Create the directory for the flexlm user to use, e.g., /opt/flexlm
  2. Place all the binaries for the licence manager and the licence in a vendor specific subdirectory

At this point you should have something similar to following directory structure:

/opt/flexlm/
└── VENDOR
    ├── licence.lic
    ├── lmgrd
    ├── lmutil
    └── pam_lmd

Create service file

See lm-vendor.service as shown below replacing all instences of VENDOR with the name of your vendor (e.g., IDL) and save the file in /etc/systemd/system/.

Note that in line 11 we specify that the return code 15 should be considered a successful exit code which is the code that lmgrd will emit when killed with SIGTERM. It is also important to note that on line 9 we are forcing lmgrd to run in the forground with -z, this allows us to use Type=simple on line 6, and let systemd send the default signal SIGTERM to the process. This also has the nice side effect of making all the logs emited by lmgrd show up in journalctl.

Create flexlm user

  1. Create flexlm group with groupadd flexlm -g 124
  2. Create user with useradd flexlm -d /opt/flexlm -c "FlexLM User" -u 124 -g 124 -s /sbin/nologin
  3. Set flexlm as owner of /opt/flexlm with chown flexlm:flexlm -R /opt/flexlm

Enable and start service

systemctl enable lm-vendor
systemctl start lm-vendor
[Unit]
Description=Licence manger for VENDOR
After=network.target
[Service]
Type=simple
User=flexlm
WorkingDirectory=/opt/flexlm/VENDOR
ExecStart=/opt/flexlm/VENDOR/lmgrd -z -c licence.lic
SuccessExitStatus=15
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
@data-ux
Copy link

data-ux commented Sep 17, 2021

Thanks! This is just what I needed.

@iamc
Copy link

iamc commented Feb 16, 2022

Exactly what I was looking for, many thanks!

@Radiognome1971
Copy link

Thanks for giving me a direction for this,

I added

ExecReload=/opt/flexlm/VENDOR/lmutil lmreread -c licence.lic
ExecStop=/opt/flexlm/VENDOR/lmutil lmdown -c licence.lic -q -force

Now systemctl reload and stop work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment