MATLAB Answers

how to start flexlm at boot Mac OS X 10.11

7 views (last 30 days)
Matthew Fasano
Matthew Fasano on 29 Jan 2016
Commented: Matthew Fasano on 12 Feb 2016
How do I have Flexlm start at boot. I tried moving the MATLABLmgr directory to the /Library/StartupItems directory with the appropriate changes to the script MATLABLmgr. I am able to start the flexlm fine manually.
Here is the MATLABLmgr script in /Library/StartupItems
#!/bin/sh
# The MATLAB installer application (InstallForMacOSX) will automatically configure
# and install this script. To install this script manually, perform the following
# actions as an Administrator:
#
# 1. Navigate via the Finder to the top level /Library folder.
# 2. Create a folder within /Library called StartupItems, if it does not already exist.
# 3. Copy the $MATLAB/etc/MATLABLmgr folder into the StartupItems folder.
# 4. Open /Library/StartupItems/MATLABLmgr/MATLABLmgr with a text editor.
# 5. Change <PATH_TO_MATLAB> to be the location where MATLAB is installed.
# 6. Change <USER_NAME_FOR_LICENSE_MANAGER> to be the short user name under which the
# license manager daemon will be started (for security reasons, this must not be
# "root").
# 7. Save MATLABLmgr back to disk. If your text editor gives you the option to choose
# line ending styles (Macintosh versus UNIX), be sure to choose UNIX line endings.
# 8. Reboot.
. /etc/rc.common
#
MATLAB=/Applications/MATLAB_R2015b.app # example: MATLAB=/Applications/MATLAB_R2011a.app
ME=matthewfasano # example: ME=cmoler
StartService ()
{
### start FLEXnet ###
ConsoleMessage "Starting MATLAB License Manager"
LMBOOT="$MATLAB/etc/lmboot"
if [ -f $LMBOOT ]; then
# Sleep for a while to make sure all the networking services
# have started up. Otherwise the hostname in the license file
# or the username we are su'ing to might not be resolvable.
sleep 30
$MATLAB/etc/lmboot -u $ME
else
echo "Cannot locate $LMBOOT"
ConsoleMessage -F
fi
}
StopService ()
{
### stop FLEXnet ###
ConsoleMessage "Stopping MATLAB License Manager"
LMDOWN="$MATLAB/etc/lmdown"
if [ -f $LMDOWN ]; then
$LMDOWN
else
echo "Cannot locate $LMDOWN"
ConsoleMessage -F
fi
}
RestartService ()
{
### stop then start FLEXnet ###
StopService
StartService
}
RunService "$1"
Thanks

  1 Comment

Matthew Fasano
Matthew Fasano on 12 Feb 2016
using StartupItems will not work. I am now trying to start lmgrd with a LaunchDaemon I put the the following plist file in the directory /Library/LaunchDaemons
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GroupName</key>
<string>staff</string>
<key>InitGroups</key>
<true/>
<key>Label</key>
<string>MATLAB License Manager</string>
<key>LaunchOnlyOnce</key>
<true/>
<key>Program</key>
<string>/Applications/MATLAB_R2015b.app/etc/lmstart</string>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/MATLAB License Manager.stderr</string>
<key>StandardOutPath</key>
<string>/tmp/MATLAB License Manager.stdout</string>
<key>UserName</key>
<string>matthewfasano</string>
</dict>
</plist>
The log file suggest it runs fine, but lmgrd is not running.

Sign in to comment.

Answers (1)

Abhisek Roy
Abhisek Roy on 5 Feb 2016
Hi Matthew,
Starting with MATLAB R14, the license manager is configured to start automatically during the installation of the license manager. If you move the installation to a new computer, have an older release of MATLAB, or need to setup the license manager to start, see the instructions below:
The folder $MATLAB/etc/MATLABLmgr contains files that can automatically start the license manager at boot time. By installing and configuring the scripts this folder, you will not have to manually start the license manager after rebooting your machine and/or prior to starting MATLAB. You must be an Administrator to install the scripts in this folder.
Installing the Scripts:
1) Navigate to the top level /Library folder.
2) Create a folder within /Library called StartupItems, if it does not already exist.
3) Copy the $MATLAB/etc/MATLABLmgr folder into the StartupItems folder.
4) Run the Terminal application (/Applications/Utilities) and in the Terminal window enter the commands:
cd /Library/StartupItems/MATLABLmgr ./config_lm.sh
5) The script runs and asks you to enter the directory where MATLAB is installed for example:
MATLAB=/Applications/MATLAB6P5P2
6) The script will then ask you for your username. You must start the license manager as a non-root user. The license manager cannot be started as root. For example, you can use your own username. To find your username, run 'whoami' command in Terminal.
7) After the script has finished, reboot your machine.
During boot, the message "Starting MATLAB License Manager" should appear on the screen.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by