# 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 ```