### ### get_listener_ports.sh ### ### ### Calls get_listener_ports.jacl ### ### Generates JACL source code for configuring listener ports ### ### Take the output and plug it into set_listener_ports.jacl ### ### ### Usage: ### get_listener_ports.sh servername ### USAGE=" Usage: $0 -u username -p password -c cell -n node -s server " while getopts "u:p::c:n:s:" 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_listener_ports.jacl " echo "### " echo "### " echo "### " echo "### " echo "### " echo " " echo "proc set_listener_ports {cname nname sname} { " echo " " echo " " echo "### " echo "### set up globals " echo "### " echo " " echo "global AdminConfig " echo "global AdminControl " echo "global AdminApp " echo " " echo "set serverid [\$AdminConfig getid /Cell:\$cname/Node:\$nname/Server:\$sname/] " echo " " echo "if {[llength \$serverid] == 0} { " echo " puts \"Serverid null - returning \" " echo " exit " echo "} " echo " " echo "### " echo "### Identify the message listener service belonging to the server " echo "### " echo " " echo "set mls [\$AdminConfig list MessageListenerService \$serverid] " echo " " echo " " echo "### " echo "### Configure listener ports" echo "### " echo " " wsadmin.sh -username $xuser -password $xpasswd -f get_listener_ports.jacl $xcell $xnode $xserver | \ grep -v WASX7209I | \ sed "s,{managedObject .*)},,g" | \ sed "s,listenerPorts,," | \ sed "s,/$xcell/,/\$cname,g" | \ sed "s,/$xnode/,/\$nname,g" | \ sed "s,/$xserver},/\$sname},g" | \ sed "s/{{connectionFactoryJNDIName/\\ \\ {{connectionFactoryJNDIName/g" | \ sed "s/^{ {$//" | \ sed "s/^}}}}}$/}}} /" | \ sed "s/{{connectionFactoryJNDIName/\$AdminConfig create ListenerPort \$mls {{connectionFactoryJNDIName/" | \ sed "s,}$,} \\\\," #sed "s/{}/\"\"/g" | \ #sed "s/{/\[list /g" | \ #sed "s/}/\] /g" #$AdminConfig create ListenerPort $mls {{destinationJNDIName prefix/jms/QueueB}{connectionFactoryJNDIName prefix/jms/XaQueueConnectionFactory} {maxMessages 1}{maxRetries 0}{maxSessions 5}{name ErrorBizDocMessageEJBPort}{stateManagement {{initialState START}}}} echo " " echo "\$AdminConfig save " echo " " echo "} " echo " " echo " " echo " " echo "### " echo "### Main " echo "### " echo " " echo " " echo "if { !(\$argc == 3) } { " echo " puts \"\" " echo " puts \"Usage: \" " echo " puts \" \" " echo " puts \"wsadmin.sh -username system -password password -f set_listener_ports.jacl cellname nodename servername\" " echo " puts \"\" " echo " puts \"For example: \" " echo " puts \" \" " echo " puts \"wsadmin.sh -username was -password acme@ -f set_listener_ports.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_listener_ports \$xcell \$xnode \$xserver " echo "} "