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

# starts the zone, the paramters are passed in options

MYNAME=`basename ${0}`
MYDIR=`dirname ${0}`

typeset opt

while getopts 'R:G:P:' opt
do
        case "${opt}" in
                R)      RESOURCE=${OPTARG};;
                G)      RESOURCEGROUP=${OPTARG};;
                P)      PARDIR=${OPTARG};;
                *)      logger -p daemon.err \
                        "ERROR: ${MYNAME} Option ${OPTARG} unknown"
                        exit 1;;
        esac
done

. ${MYDIR}/../etc/config 			# debugging flags
. ${MYDIR}/functions			# agent specific functions
. ${MYDIR}/../../lib/functions		# functions common for all the agents
. ${MYDIR}/../../lib/functions_common	# functions common for all the zone components

debug_message "Method: ${MYNAME} - Begin"
${SET_DEBUG}

# Checks the syntax of the options

if ! validate_options
then
        debug_message "Method: ${MYNAME} - End (Exit 1)"
        exit 1
fi

rm ${LOGFILE} 2>/dev/null

# checks the semantic of the options and the parameter file

if ! validate
then
        debug_message "Method: ${MYNAME} - End (Exit 1)"
        exit 1
fi

# source the zone boot specific parameter file

. ${PARFILE}

if  start_sczbt
then
        log_message notice "start_command rc<${rc_start_command}>"
        debug_message "Method: ${MYNAME} - End ${rc_start_command}"
        exit 0
else
        log_message err "start_command rc<${rc_start_command}>"
fi

debug_message "Method: ${MYNAME} - End (Exit 0)"

exit 0
