#!/usr/bin/ksh
#
# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

typeset opt

while getopts 'R:G:N:' opt
do
        case "$opt" in
                R)      RESOURCE=$OPTARG;;
                G)      RESOURCEGROUP=$OPTARG;;
                N)      PARFILE=$OPTARG;;
                *)      logger -p daemon.err \
                        "ERROR: `basename $0` Option $OPTARG unknown"
                        exit 1;;
        esac
done

. `dirname $0`/../etc/config
. `dirname $0`/functions

# Set variables
LOGFILE=/var/tmp/${RESOURCE}_logfile

validate_options

debug_message "Method: `basename $0` - Begin"
$SET_DEBUG

rm $LOGFILE 2>/dev/null

validate

if [ "$rc_validate" -ne 0 ]
then
        debug_message "Method: `basename $0` - End (Exit 1)"
        exit 1
fi

# Source the Tomcat Specific Parameter file
. ${PARFILE}

start_Tomcat

if [ "$rc_start_command" -eq 0 ]
then
        log_message notice "start_command rc<$rc_start_command>"
        debug_message "Method: `basename $0` - End (Exit 0)"
        exit 0
else
        log_message error "start_command rc<$rc_start_command>"
fi

debug_message "Method: `basename $0` - End (Exit 0)"

exit 0
