#!/sbin/sh
#
# Start or stop the FLEXlm deamon (sample)
#
# You can get detailed information about FLEXlm on the Internet at
# http://www.globetrotter.com
#
# This example is provided has is, you might have to manually edit it's content
#

FLEXLM=/usr/local/flexlm/bin/lmgrd
FLEXLMFILE=/usr/local/flexlm/licenses/softimage.dat
FLEXLMLOG=/usr/local/flexlm/log/softimage.log

IS_ON=/etc/chkconfig

case "$1" in
   'start')
        if $IS_ON flexlm && test -x $FLEXLM
        then
                if $IS_ON verbose
                then
                        echo "Starting FLEXlm"
                fi
                $FLEXLM -c $FLEXLMFILE -l $FLEXLMLOG
        fi
        ;;
   'stop')
	# Use kill -9 instead of lmdown to avoid shutting down all deamons
	# if the setup is redundant
	echo "Killing FLEXlm Daemons..." >>$FLEXLMLOG 2>&1
	/etc/killall -TERM lmsoft lmsoft lmsoftgrs lmsoftgrsed >>$FLEXLMLOG 2>&1
        ;;
   *)
        echo "usage: $0 {start|stop}"
        ;;
esac
