Skip to main content
Skip table of contents

Sample: lmgrd-ivs startup script

This is a script that can be used to startup the lmgrd-ivs daemons for our license server.

 

CODE
#!/bin/sh
#
# lmgrd-ivs       This shell script takes care of starting and stopping
#                 the FlexLM License Server for Fledermaus network
#                 licenses.
#
# To install:
#  1.  Place this script in /etc/init.d
#  2a. Run chkconfig --add lmgrd-ivs
#      This automatically enables the script in run levels 3,4 and 5
#  2b. Systems without chkconfig will require manually creating
#      symlinks in the appropriate /etc/rcX.d directories to the script.
#  3.  Edit this script to your liking, setting at least IVSHOME. 
#
#
# description: lmgrd is a license server that is used
# to distribute licenses to needy client machines.
# chkconfig: 345 99 05 
# probe: true
#
# Created:  2004-02-20 wb
# Modified: 2004-12-14 wb - Sun fix, shutdown fix, added reload


#
# EDIT the next four items to suit your situation.
# These are the defaults for when using the IVS installers.
#

# 1. Where Fledermaus was installed.  This is the default
#    given when installing Fledermaus.  
#    This may be the only value that you have to edit!
IVSHOME="/data1/IVS7"

# 2. Where the lmutil program is stored.
LMUTIL_PATH="$IVSHOME/lmutils"

# 3. Where the lmutils license server and license are stored.
LMSERVER_PATH="$IVSHOME/lmutils/server"

# 4. The user that the license server runs as.
#    This user must have login privileges, "nobody" might not on some systesm.
LIC_USER="nobody"

# 5. Log file name.  Note that the server deletes the log each restart,
#                    unless you add + in front of the file name.
#                    Deleting is GOOD, unless the file is /dev/null.
LOG_FILE="+/var/log/lmgrd.log"

#### Do not edit below this line ###

DAEMON="lmgrd"
SU="su -s /bin/bash $LIC_USER -c"
RETVAL=0
prog="FLEXlm server"

start() {
        # Start daemons.
        echo -n "Starting $prog: "
        if [ `/bin/uname` = SunOS ]; then
          # Workaround for Solaris problem with too many file descriptors.
          ulimit -n 1024
        fi
        $SU "$LMSERVER_PATH/$DAEMON -c $LMSERVER_PATH/serverLicense.dat -l $LOG_FILE"
        RETVAL=$?

	/bin/sleep 5
        if [ $RETVAL -eq 0 ]; then
	  echo done.
        else
	  echo FAILED.
        fi

	return $RETVAL
}

reload() {
        # Reload the IVS daemon.
        echo -n "Reloading $prog: "
        	
	stop
	start
#	$LMUTIL_PATH/lmutil lmdown -c $LMSERVER_PATH/serverLicense.dat -vendor ivs -q
#	$LMUTIL_PATH/lmutil lmreread -c $LMSERVER_PATH/serverLicense.dat -vendor ivs -q
        RETVAL=$?

        if [ $RETVAL -eq 0 ]; then
	  echo done.
        else
	  echo FAILED.
        fi
	        
	return $RETVAL
}

stop() {
        # Stop all daemons.
        echo -n "Stopping $prog: "
        	
	killall lmgrd
#	$LMSERVER_PATH/$DAEMON -x lmdown -c $LMSERVER_PATH/serverLicense.dat
        RETVAL=$?

        if [ $RETVAL -eq 0 ]; then
	  echo done.
        else
	  echo FAILED.
        fi
	        
	return $RETVAL
}

status() {
#	$LMUTIL_PATH/lmutil lmstat -c $LMSERVER_PATH/serverLicense.dat
#	return $?
	return 0
}
	
restart() {
	stop
	start
}
	

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	status)
		status
		;;
	restart)
		restart
		;;
        reload)
                reload
                ;;
	*)
        	echo Usage: $0 '{start|stop|status|restart|reload}'
		exit 1
                ;;
esac

exit $?
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.