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

USE_INTERNAL_DEP=TRUE

typeset opt

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

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

validate_options

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

rm $LOGFILE 2>/dev/null

#validate "$GATEWAYDIR/bin/sag_bootstrap"
validate "$GATEWAY_DIR/bin/sag_bootstrap"
if [ "$rc_validate" -ne 0 ]
then
        debug_message "Method: `basename $0` - End (Exit 1)"
        exit 1
fi

start_sag

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

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

exit 0
