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

typeset opt

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

if ps -u mqm -o pid,args | eval /usr/xpg4/bin/grep -E '$PATTERN' |\
	grep -w amqpcsea > /dev/null
then
	stop_csv

	if [ $rc_endmqcsv -eq 0 ]
	then
		log_message notice endmqcsv
	else
		log_message error endmqcsv
		cleanup_csv
	fi
fi

set_status OFFLINE

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

