#!/bin/bash # # JP Renaud - 26/09/2006 # /etc/init.d/tecplotlm: start and stop 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 # # 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 was written for Kubuntu Linux Dapper but should # work with minor modifications on most Linux flavours. # # Installation: After dropping this file in your /etc/init.d/ directory, make it # executable and add it to the relevant runlevels. # On (K)ubuntu, use: # sudo update-rc.d tecplotlm defaults ################################################################################### # Load Linux Standard base init functions (log_begin_msg etc...) . /lib/lsb/init-functions #Make sure that the script is run with suid 0 for start/stop (and therefore restart!) if [ `id -u` != "0" ] && [ "$1" = "start" -o "$1" = "stop" ] ; then log_failure_msg "You must be root to start, stop/kill or restart the Tecplot license manager." exit 1 fi # Minimum checks on Tecplot installation # Location of the Tecplot directory in TECHOME must be customised if necessary TECHOME=/usr/local/tec360 if [ ! -d $TECHOME ] ; then log_failure_msg "Problem: $TECHOME does not exist. Check your Tecplot installation" exit 1 fi if [ ! -f $TECHOME/tlm/tlmd ] ; then log_failure_msg "Problem: $TECHOME/tlm/tlmd does not exist. Check your Tecplot installation" exit 1 fi if [ ! -f $TECHOME/tlm/tlmadmin ] ; then log_failure_msg "Problem: $TECHOME/tlm/tlmadmin does not exist. Check your Tecplot installation" exit 1 fi if [ ! -f $TECHOME/tlm/tlm.log ] ; then log_failure_msg "Problem: $TECHOME/tlm/tlm.log does not exist. Check your Tecplot installation" exit 1 fi VERB="$1" shift case "$VERB" in start) log_begin_msg "Starting the Tecplot license manager..." STATUS=0 # Check that license manager is not currently running # We look if the tlmd process is running or not # This is avery crude test and could (should?) probably be improved TEST=`ps -A | grep tlmd` if [ -n "$TEST" ] ; then log_failure_msg "Problem: it looks like the Tecplot license manager is already running." log_failure_msg "Problem: stop it first (or issue a restart)." exit 1 fi $TECHOME/tlm/tlmd -l $TECHOME/tlm/tlm.log -e $TECHOME/tlm -s 1 RES=$? test $RES = 0 || STATUS=1 log_end_msg $STATUS ;; stop|kill) log_begin_msg "Killing the Tecplot license manager..." STATUS=0 $TECHOME/tlm/tlmadmin -x -k RES=$? test $RES = 0 || STATUS=1 log_end_msg $STATUS ;; restart) "$0" stop && "$0" start ;; *) log_failure_msg "Usage: $0 start|stop|kill|restart" exit 1 ;; esac exit 0