#!/bin/sh
# -*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# Jakarta Tomcat startup script.
#
# $FreeBSD: ports/www/jakarta-tomcat4/files/startup.sh,v 1.6 2006/10/22 03:56:14 lawrance Exp $
#


# Set some variables
MYSELF=`basename $0`

case "$1" in
	start)
		echo -n ' '
		truncate -s 0 /var/run/tomcat3.pid
		chown www:www /var/run/tomcat3.pid
		chmod 600 /var/run/tomcat3.pid
		su -f -m www -c "exec /usr/local/bin/tomcat3ctl start" >/dev/null && echo -n 'tomcat3'
		;;
	stop)
		echo -n ' '
		chown www:www /var/run/tomcat3.pid
		chmod 600 /var/run/tomcat3.pid
		su -f -m www -c "exec /usr/local/bin/tomcat3ctl stop" >/dev/null 2>&1 ; echo -n 'tomcat3'
		;;
	*)
		echo ""
		echo "Usage: ${MYSELF} { start | stop }"
		echo ""
		exit 64
		;;
esac
