How do I get the Network License Manager to start automatically at boot time on Linux?

조회 수: 95(최근 30일)
How do I get the Network License Manager to start automatically at boot time on Linux? I would like the license manager to start automatically every time I reboot my machine.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2022년 2월 1일
편집: MathWorks Support Team 2022년 2월 1일
See the MATLAB License Manager documentation for information about starting the license manager at boot:
For instructions on starting services automatically on various Linux distributions, please see the documentation for that distribution. (note: MathWorks does not support these methods. You will need to consult a Linux admin or your local IT support if you have issues with these methods)
RHEL/CentOS 6 and below:
RHEL/CentOS 7 and above:
Debian:
Ubuntu:
SuSE:
  댓글 수: 6
Michal Bassa
Michal Bassa 2022년 9월 14일
Dear Matlab Team,
most distributions nowadays use systemd, could you provide a .service file for the License Manager?
Currently stopping the License Manager using the official docs is not working, because:
  • Apparently the order of arguments is important and lmdown must appear before specifying the license file -c.
  • I wrote a systemd service using the recommended way and after systemctl stop the License Manager cannot be started for another ~60 seconds. And systemd reports stopping as failed with code 15.
My service is:
# /etc/systemd/system/matlab_license_manager.service
[Unit]
Description=MATLAB FlexLM License Manager
After=network.target
# https://www.mathworks.com/matlabcentral/answers/105860-how-do-i-install-the-network-license-manager
# https://www.mathworks.com/matlabcentral/answers/102968-how-do-i-start-or-stop-the-network-license-manager
# https://www.mathworks.com/matlabcentral/answers/102886-how-do-i-get-the-network-license-manager-to-start-automatically-at-boot-time-on-linux
# https://www.mathworks.com/matlabcentral/answers/100538-why-do-i-receive-license-manager-error-13
[Service]
User=mlm
Type=forking
ExecStart=/opt/matlab_license_manager/etc/glnxa64/lmgrd -c /opt/matlab_license_manager/etc/license.dat -l /opt/matlab_license_manager/lmlog.txt
ExecStop=/opt/matlab_license_manager/etc/glnxa64/lmutil lmdown -c /opt/matlab_license_manager/etc/license.dat -q
[Install]
WantedBy=multi-user.target

댓글을 달려면 로그인하십시오.

추가 답변(4개)

Richard Nickle
Richard Nickle 2017년 6월 15일
편집: Richard Nickle 2017년 6월 15일
https://stackoverflow.com/questions/41254104/systemd-service-unit-file-as-user gave me a great hint.
I ended up using this as a base:
#
# based on:
# https://stackoverflow.com/questions/41254104/systemd-service-unit-file-as-user
#
# templated
#
[Unit]
Description=MATLAB FlexLM license manager
[Service]
Type=forking
ExecStart=/usr/local/MATLAB/R2017a/etc/lmstart
ExecStop=/usr/local/MATLAB/R2017a/etc/lmdown
KillMode=none
Restart=on-failure
RestartSec=90
# it would be nice to templatize this
User=lmgrd
[Install]
WantedBy=multi-user.target
  댓글 수: 2
MBS IT
MBS IT 2020년 1월 15일
Will this work on RHEL (i am running 8.1)?
I really do not want to mess something up here.

댓글을 달려면 로그인하십시오.


Donald Wu
Donald Wu 2018년 4월 30일
Thanks Richard,
The service script works on Ubuntu 16.04. I created a symbolic link "Current" to the latest Matlab installation folder, such "R2018a" and use the "Current" folder name in the script so that the script can be same after the new version is installed.

Soporte Técnico MODEMAT
Soporte Técnico MODEMAT 2020년 3월 31일
I made some changes to the Richard's file and it is working for me:
#
# Modificado para la versión de Matlab R2019b
# Creado el 31/03/2020
#
#
#
[Unit]
Description=MATLAB FlexLM license manager
After=network.target
[Service]
User=lmgrd
Type=forking
ExecStart=/usr/local/MATLAB/R2019b/etc/lmstart
ExecStop=/usr/local/MATLAB/R2019b/etc/lmdown
KillMode=none
Restart=on-failure
RestartSec=90
[Install]
WantedBy=multi-user.target

Rob Kudyba
Rob Kudyba 2021년 5월 5일
I'd like to suggest that where you have:
ExecStart=/usr/local/MATLAB/R2019b/etc/lmstart
Include an option for the path to the license file, use lmgrd and a path to a log file that the user who starts the licensing server has access to so something like:
[Unit]
Description=MATLAB FlexLM license manager
After=network.target
[Service]
User=lmgrd
Type=forking
ExecStart=/usr/local/MATLAB/R2021a/etc/glnxa64/lmgrd -c /path/to/license.dat -l /path/to/logfile
ExecStop=/usr/local/MATLAB/R2021a/etc/glnxa64/lmdown
KillMode=none
Restart=on-failure
RestartSec=90
[Install]
WantedBy=multi-user.target
  댓글 수: 1
James McCartney
James McCartney 2022년 6월 1일
편집: James McCartney 2022년 6월 1일
Add a -q (quiet) to lmdown or it will go interactive with a "Are you sure?" prompt. I also add a script to archive the last log file when starting, not necessary, totally optional.
ExecStartPre=/usr/local/MATLAB/archive-logs.sh
ExecStop=/usr/local/MATLAB/R2021a/etc/glnxa64/lmdown -force -q

댓글을 달려면 로그인하십시오.

범주

Find more on Manage Products in Help Center and File Exchange

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by