get_MQ_Queues.sh

 


###
### get_MQ_Queues.sh
###
###
### Calls get_MQ_Queues.jacl
###
### Generates JACL source code for configuring MQQueue
###
### Take the output and plug it into get_MQQueue.jacl
###
###
### Usage:
###    get_MQQueue.sh cellname nodename servername
###

USAGE=" 
Usage: $0 -u username -p password -c cell -n node -s server 
"


while getopts "u:p::c:n:s:l" opt; do
  case $opt in
    u ) xuser=$OPTARG ;;
    p ) xpasswd=$OPTARG ;;
    c ) xcell=$OPTARG ;;
    n ) xnode=$OPTARG ;;
    s ) xserver=$OPTARG ;;
    * ) echo $USAGE
         exit 1 ;;
  esac
done


if [ "$xserver" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xuser" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xpasswd" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xcell" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xnode" = "" ]
then
    echo $USAGE
    exit 1
fi


echo "###   "
echo "### set_MQQueue.jacl   "
echo "###   "
echo "###   "
echo "###   "
echo "###   "
echo "###   "
echo "   "
echo "proc set_MQQueue {cname nname sname} {   "
echo "   "
echo "   "
echo "###   "
echo "### set up globals   "
echo "###   "
echo "   "
echo "global AdminConfig   "
echo "global AdminControl   "
echo "global AdminApp   "
echo "   "
echo "   "
echo "set JMSProviderIDs [\$AdminConfig getid /Cell:\$cname/Node:\$nname/Server:\$sname/JMSProvider:/] "
echo "   "
echo "      if {[llength \$JMSProviderIDs] == 0} { "
echo "         puts \"JMSProvider ID null - returning \" "
echo "         continue  "
echo "      } "
echo " "
echo "   "
echo "foreach JMSProviderID \$JMSProviderIDs {   "
echo " "
echo "#    set JMSProviderName [$AdminConfig showAttribute \$JMSProviderID name] "
echo " "


wsadmin.sh -username $xuser -password $xpasswd -f get_MQ_Queues.jacl $xcell $xnode $xserver   | \
grep -v WASX7209I  | \
grep -v "^{provider " | \
sed "s,}$,} \\\\,"



echo "   "
echo "}   "
echo "   "
echo "\$AdminConfig save   "
echo "   "
echo "}   "
echo "   "
echo "   "
echo "   "
echo "###   "
echo "### Main   "
echo "###   "
echo "if { !(\$argc == 3) } {   "
echo "   puts \"\"   "
echo "   puts \"Usage:  \"   "
echo "   puts \" \"   "
echo "   puts \"wsadmin.sh -username system -password password -f set_MQQueue.jacl cellname nodename servername\" "
echo "   puts \"\"   "
echo "   puts \"For example:  \"   "
echo "   puts \" \"   "
echo "   puts \"wsadmin.sh -username was -password acme@ -f  set_MQQueue.jacl hostnameNetwork hostname ops_1_1\" "
echo "} else {    "
echo "   set xcell        [lindex \$argv 0]     "
echo "   set xnode        [lindex \$argv 1]     "
echo "   set xserver      [lindex \$argv 2]     "
echo "   set_MQQueue \$xcell \$xnode \$xserver    "
echo "}   "