#!/bin/sh
#
# TrendServerControl - TrendServer delegating init script
#

TRENDSERVER=#TRENDSERVER#
USERID=#USERID#

case `basename $0` in
	S*)	cmd=start	;;
	K*)	cmd=stop	;;
	*)	cmd=$1		;;
esac

su $USERID -c "$TRENDSERVER/bin/TrendServerControl.sh $cmd"

# On Linux we must create a "lockfile" when we "start",
# otherwise we'll not get asked to "stop" later.

if [ `uname -s` = Linux ] ; then
	lockfile=/var/lock/subsys/trendserver
	case $cmd in
		start)	touch $lockfile ;;
		stop)	rm $lockfile 2> /dev/null ;;
	esac
fi

exit 0
