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

typeset opt

while getopts 'R:G:' opt
do
        case "$opt" in
                R)      RESOURCE=$OPTARG;;
                G)      RESOURCEGROUP=$OPTARG;;
                *)      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

stop_SAA

if [ "$rc_stop_command" -eq 0 ]
then
        log_message notice "stopped SAA rc<$rc_stop_command>"
        debug_message "Method: `basename $0` - fall through to stop_dce"
else
        log_message error "stop SAA failed rc<$rc_stop_command>"
fi

stop_dce

if [ "$rc_stop_command" -eq 0 ]
then
        log_message notice "stopped dce rc<$rc_stop_command>"
        debug_message "Method: `basename $0` - End (Exit 0)"
	set_status STOPPED
        exit 0
else
        log_message error "stop dced failed rc<$rc_stop_command>"
fi
debug_message "Method: `basename $0` - End (Exit 0)"
exit 0
