For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > lmgrd init script

lmgrd init script

Created by dave. Last edited by dave, 6 years and 63 days ago. Viewed 5,284 times. #6
[diff] [history] [edit] [rdf]
labels
attachments
lmgrd-VENDOR (2153)
(16 October 2012)

A simple init.d script for lmgrd on CentOS

#!/bin/bash
#
# chkconfig: 2345 90 10
# description: FLEXlm license manager generic startup script
# processname: lmgrd

# Edit as appropriate...

PROGNAME=lmgrd-VENDORNAME LICENSE=/path/to/license.dat LMDIR=/path/to/licence/bin-directory LMUSER=someuser

# You shouldn't have to edit below here

. /etc/rc.d/init.d/functions

LOCK=/var/lock/subsys/$PROGNAME LOG=/var/tmp/$PROGNAME.log

checklog() { [ -f $LOG ] || /bin/touch $LOG /bin/chown $LMUSER $LOG }

start() { echo -n $"Starting $PROGNAME: " if [ "$LICENSE" != "" ] ; then checklog daemon --user=$LMUSER $LMDIR/lmgrd \ -c $LICENSE \ -l $LOG \ && /bin/touch $LOCK \ && success || failure RETVAL=$? else echo -n "no license file" && failure fi echo return $RETVAL }

stop() { echo -n $"Stopping $PROGNAME: " if [ "$LICENSE" != "" ] ; then checklog echo y | $LMDIR/lmutil lmdown \ -c $LICENSE \ >> $LOG \ && /bin/rm -f $LOCK \ && success || failure RETVAL=$? else echo -n "no license file" && failure fi echo return $RETVAL }

case "$1" in

start) start ;;

stop) stop ;;

restart) stop echo "Waiting for port cycle (10 seconds)" sleep 10 start ;;

condrestart) if [ -f $LOCK ]; then

stop start

fi ;;

status) [ ! -f $LOCK ] && echo "$PROGNAME is not running" && exit 0

if [ "$LICENSE" != "" ]; then

$LMDIR/lmutil lmstat -a -c $LICENSE RETVAL=$?

else

echo "no license file"

fi ;;

*) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1

esac

exit $RETVAL

Put this in /etc/init.d as lmgrd-VENDORNAME, renamimg as appropriate. Then do

# chkconfig --add lmgrd-VENDORNAME
...and you should be good to go.
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt