#!/bin/sh # # mglmr MaGic License Manager for Red hat # # functions start the FLEXlm license manager # # version /etc/rc.d/init.d/mglmr 0.3 (pre.alpha) 06.10.2000 # to be used with red hat # # author klaus-dieter uhlich, kladde # # mailing list: www.egroups.com/groups/magicu-l # # LM_PATH: directory of the FLEXlm license manager # default is "/usr/magicadm/license" LM_PATH=/usr/magicadm/license # LM_USER: get the environment of an user # default is "magicadm". LM_USER=magicadm # # # # # source function library . /etc/rc.d/init.d/functions # # chkconfig: 3 91 92 # description: start the magic broker\ # # set additional messages based on functions # to give more information. # echo_up() { [ "$BOOTUP" = "color" ] && $MOVE_TO_COL echo -n "[ " [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING echo -n "UP" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL echo -n " ]" echo -ne "\r" return 1 } echo_down() { [ "$BOOTUP" = "color" ] && $MOVE_TO_COL echo -n "[ " [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING echo -n "DOWN" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL echo -n " ]" echo -ne "\r" return 1 } # # if you are not $LM_USER recall this script with $LM_USER. # if [ "$USER" != "$LM_USER" ] ; then su $LM_USER -c "umask 022; $0 $1" exit $? fi # # test the enviroment variables # if [ ! -f $LM_PATH/lmgrd ] ; then echo -n "mglmr: $LM_PATH/lmgrd not found" echo_failure echo exit 1 fi # if [ ! -f $LM_PATH/license.dat ] ; then echo -n "mglmr: $LM_PATH/license.dat not found" echo_failure echo exit 2 fi # # # # See how we were called. # RETVAL=0 echo -n "mglmr service $1:" case "$1" in start) if [ ! -f /var/lock/subsys/mglmr ]; then cd $LM_PATH $LM_PATH/lmgrd -c $LM_PATH/license.dat -l $LM_PATH/license.log.$$ RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/mglmr echo_success fi else echo_up fi echo ;; stop) if [ -f /var/lock/subsys/mglmr ]; then killproc $LM_PATH/lmgrd RETVAL=$? rm -f /var/lock/subsys/mglmr else echo_down fi echo ;; reload|restart) echo $0 stop $0 start RETVAL=$? ;; status) status $LM_PATH/lmgrd RETVAL=$? ;; *) echo echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit $RETVAL