#!/bin/sh
#  $Id: rcfulltws.sh,v 1.4 2005/06/20 19:15:55 peterc Exp $
#  Copyright (C) 2003-2005 Tarantella, Inc.
#  This software code contains proprietary information 
#  and should be treated as confidential.
#
# chkconfig: @@CHKCONFIG@@
# description: Tarantella Web Server

# Start/stop Tarantella Web Services

# This file runs the default installation of Tarantella Web Services
# This file will be replaced when setup is run
# If you want to make changes to this file, move it to a new
# filename first.

# 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 "@@TTA_DIR@@" >/dev/null 2>&1
TTADIR="@@TTA_DIR@@"
tta_script=@@TTA_SCRIPT@@

lockname=TarantellaWebServer
lockdir=/var/lock/subsys
lockfile=${lockdir}/$lockname

if [ -x $tta_script ]; then
  case $1 in
    stop )
	$tta_script webserver stop 1>/dev/null 2>&1
	[ -f $lockfile ] && rm -f $lockfile
	;;
    start )
        [ -f $TTADIR/webserver/.TWS_secure ] && ssl="--ssl" || ssl=""
	$tta_script webserver start $ssl --quiet
	[ -d $lockdir -a ! -f $lockfile ] && touch $lockfile
	;;
    stop_msg )
	echo "Stop Tarantella Web Server"
	;;
    start_msg )
	echo "Start Tarantella Web Server"
	;;
    * )
	echo "$0 [start|stop|start_msg|stop_msg]"
	;;
  esac
else
  echo "$0: cannot find $TTADIR/$tta_script" 1>&2
fi

cd $cwd
