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

typeset opt

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

rm $LOGFILE 2>/dev/null

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

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

start_chi

# runmqchi will only ouput error messages, which is 
# why log_message outputs with priority error.
# Function log_message only sends a message to syslog if
# $LOGFILE is not empty.

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