Saturday, May 19, 2012

Create WMQ QueueManager using script

Here is a handy script to make QM on Centos. This should be run after switching to mqm user.

Save the following as create_qm.sh

#!/bin/bash 
#############################################

##            Main Routine 
#############################################

main(){
echo "Checking if [$qm] exists?..."
qm=`dspmq | awk '{ print $1 }' | sed 's/QMNAME(//g;s/)//g' | grep -o $qm`
if [ "$qm" = "" ];
then
echo "Creating: [$qm]"
`crtmqm $qm`
echo "Successfully created $q, Exiting with value 0"
 else 
echo "[$qmname], already exists"
status=`dspmq -m $qmname| cut -d '(' -f2,3 | cut -d ')' -f2 | cut -d '(' -f2`
echo status of queue manager [$qm] is [$status]
fi
echo "Exiting Main Routine.. "
}
#############################################

##                 Entry Point 
#############################################

if [ ! "$1" ];
then
echo "Fail: You must pass in a queue manager name"
exit 1
else
qm=$1
echo "Queue Manager to create = $qm"
echo "Calling Main function ... "
main $*
exit 0 
fi

Use following command to create Queue Manager
create_qm.sh TEST_QM1

No comments:

Post a Comment