#!/bin/bash # # JP Renaud - 22/02/2007 # /etc/rc.d/init.d/tecplotlm: start and stop the Tecplot license manager # # chkconfig: 345 55 55 # description: manages the Tecplot license manager # tecplotlm is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. # # #################################################################### # # This file is *NOT* part of the official Tecplot 360 distribution # # #################################################################### # # Description: Makes sure that the Tecplot license manager is started at boot. # This is particularly useful for people running Tecplot on Linux # laptops which are rebooted very often. # # This init script is written for Fedora Core 6 but should # work with minor modifications on most Linux flavours. # # Installation: After dropping this file in your /etc/rc.d/init.d/ directory, make it # executable and add it to the relevant runlevels. # On Fedora, use, as root: # chkconfig --add tecplotlm # And the tecplot license manager should be up after the next reboot. # # Note: the license manager is not stopped (by this script) when shutting down, # it is just left to die. This is because killing the license manager is very # time consuming and it is simplier to let sysinit kill the process with a killall. ################################################################################### # Source function library. . /etc/init.d/functions # Location of the Tecplot directory in TECHOME must be customised if necessary TECHOME=/opt/tecplot/tec360 RETVAL=0 prog="Tecplot licence manager" start() { echo -n $"Starting $prog: " # Check that license manager is not currently running # For this, we look if the tlmd process is running or not by parsing # the output from ps with grep and if the returned string is null # we start the license manager. # This is avery crude test and could (should?) probably be improved TEST=`ps -A | grep tlmd` if [ -n "$TEST" ] ; then failure $"$prog is already running" echo exit 1 else $TECHOME/tlm/tlmd -l $TECHOME/tlm/tlm.log -e $TECHOME/tlm -s 1 RETVAL=$? ; [ $RETVAL -eq 0 ] && success || failure echo fi } stop() { # Note that stop is not called by "tecplotlm stop", # only by "tecplotlm kill" echo -n $"Stopping $prog (takes a while...): " $TECHOME/tlm/tlmadmin -x -k &> /dev/null RETVAL=$? [ $RETVAL -eq 0 ] && success || failure echo } restart() { stop start } case "$1" in start) start ;; stop) # Do nothing ;; kill) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|kill|restart}" exit 1 esac exit $RETVAL