#!/bin/sh
#  $Id: rctier3.sh,v 1.3 2005/06/20 19:15:55 peterc Exp $
#  Copyright (C) 2002-2005 Tarantella, Inc.
#  This software code contains proprietary information 
#  and should be treated as confidential.
#
# chkconfig: @@CHKCONFIG@@
# description: Tarantella Tier3 Enhancement Module
#
#  Author: stuarth
#
# Start/stop Tarantella Enhancement Module
#
# This file gets installed into the /etc/rc script area to start the
# Tier3 Tarantella Enhancement Module on boot and stop it on
# shutdown

# be paranoid about the current path
if [ -d /bin ]; then
  PATH=/bin:$PATH
fi
if [ -d /sbin ]; then
  PATH=/sbin:$PATH
fi
if [ -d /usr/bin ]; then
  PATH=/usr/bin:$PATH
fi
if [ -d /usr/sbin ]; then
  PATH=/usr/sbin:$PATH
fi
if [ -d /etc ]; then
  PATH=/etc:$PATH
fi
export PATH


CWD=`pwd`
cd "@@TEM_DIR@@" >/dev/null 2>&1
TEMDIR="@@TEM_DIR@@"
tem_script=@@TEM_SCRIPT@@

lockname=`echo $0 | sed 's;.*[0-9][0-9]*\(.*\);\1;'`
lockdir=/var/lock/subsys
lockfile=${lockdir}/$lockname

if [ -x $tem_script ]; then
  case $1 in
    stop )
	$TEMDIR/$tem_script stop --quiet
	[ -f $lockfile ] && rm -f $lockfile
	;;
    start )
	$TEMDIR/$tem_script start
	[ -d $lockdir -a ! -f $lockfile ] && touch $lockfile
	;;
    * )
	echo "$0 [start|stop]"
	;;
  esac
else
  echo "$0: cannot find $TEMDIR/$tem_script" 1>&2
fi

cd $CWD
