#!/bin/sh
# -*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# JBoss startup script.
#
# $FreeBSD: tags/RELEASE_9_1_0/java/jboss2/files/startup.sh 300896 2012-07-14 13:54:48Z beat $
#


# Set some variables
MYSELF=`basename $0`

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