Well I am no sysadmin, but when you are building a startup, you have to wear many hats.
During the last month, a couple of major EDA vendors found what we are trying to do at Coverify interesting and agreed to lend a couple of licenses to us. That made me look into how to setup the license server in a way that it actually gets started when our Ubuntu server is booted. Being a start-up, we shutdown our machine when not in use. Manually restarting the license server every-time the machine gets booted is a perceivable pain.
Getting Started
The first step is to follow the instructions from the EDA vendor on how to setup the license server. Make sure that you are able to start the server, check-out licenses and shut-down the server. Most EDA vendors use Flexlm for this purpose. Two flexlm commands come in handy. lmgrd is the license daemon and lmutil for most of the other stuff, including shutting down the daemon.
Creating the init script
Now this is the tricky part. Each linux distribution has its own way to handle this. Here is the script that works for Ubuntu Natty. I have placed this script as /etc/init.d/flexlm.vendor
#!/bin/bash
#
# chkconfig: 2345 90 10
# description: FLEXlm license manager for Vendor
# processname: lmgrd
# config: /usr/local/flexlm/etc/flexlm.conf
#
#
# vendor-daemon-specific settings
#
LMGRD=/opt/flexlm/lmgrd
LM_LICENSE_FILE=/opt/flexlm/vendor.lic
LM_LOG_FILE=/var/log/flexlm/vendor.log
LM_USER=eda
LMUTIL=/opt/flexlm/lmutil
LOCK=/var/lock/flexlm/vendor.lock
[ -x $LMGRD ] || exit 1
[ -x $LMUTIL ] || exit 1
RETVAL=0
checklog() {
[ -f $LM_LOG_FILE ] || /bin/touch $LM_LOG_FILE
/bin/chown $LM_USER $LM_LOG_FILE
}
success() {
echo success;
return 0;
}
failure() {
echo failure;
return 1;
}
start() {
echo -n $"Starting Flexlm: "
if [ "$LM_LICENSE_FILE" != "" ]; then
checklog
start-stop-daemon -u $LM_USER --start --exec $LMGRD -- -c $LM_LICENSE_FILE \
-l "+$LM_LOG_FILE" $LM_EXTRA_START_FLAGS \
? then
$LMUTIL lmdown $LM_EXTRA_STOP_FLAGS -c $LM_LICENSE_FILE -q \
>> $LM_LOG_FILE ?;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK ]; then
stop
start
fi
;;
status)
[ ! -f $LOCK ] ? then
$LMUTIL lmstat -a -c $LM_LICENSE_FILE
RETVAL=$?
else
echo "no license file"
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
Configuring the script
You have to tell the sever to automatically invoke this script to start the license server when the computer boots up and to shut it down when the server shuts down. On a Ubuntu system this is achieved by the following command:
update-rc.d flexlm.vendor defaults
That is all there is to it.