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

typeset opt

while getopts 'R:G:Q:M:U:' opt
do
        case "$opt" in
                R)	RESOURCE=$OPTARG;;
                G)	RESOURCEGROUP=$OPTARG;;
                Q)	QMGR=$OPTARG;;
                M) 	TRIGGER_MONITOR=$OPTARG;;
                U) 	USERID=$OPTARG;;
                *)	logger -p daemon.err \
                        "ERROR: Option $OPTARG unknown"
                        exit 1;;
        esac
done

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

validate_options

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

case $TRIGGER_MONITOR in
        FILE|File|file)
		while read QUEUE
		do
			if echo $QUEUE | grep '^#' > /dev/null
			then
				continue
			else
				stop_trm $QUEUE
			fi

		done < `dirname $0`/../etc/${QMGR}_trm_queues
                ;;
        *)
		stop_trm $TRIGGER_MONITOR
                ;;
esac

set_status OFFLINE

debug_message "Method: `basename $0` - End"
exit 0
