Skip to content

Instantly share code, notes, and snippets.

@iamc
Forked from kalebo/Instructions.md
Created February 16, 2022 07:33
Show Gist options
  • Save iamc/e1b2c761545cf104fdcc2cf61390bb89 to your computer and use it in GitHub Desktop.
Save iamc/e1b2c761545cf104fdcc2cf61390bb89 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment