#!/bin/sh
# -*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# JBoss startup script.
#
# $FreeBSD: ports/java/jboss3/files/startup.sh,v 1.1 2004/06/21 16:42:59 vanilla Exp $
#


# Set some variables
MYSELF=`basename $0`
JAVA_OPTS=""

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