#!/usr/bin/ksh93 # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2019,2021. All rights reserved. # # ALTRAN_PROLOG_END_TAG # # @(#) 7d4c34b 43haes/usr/sbin/cluster/sa/wmq/sbin/cl_wmq_monitorlsnr.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM ############################################################################### # # NAME: cl_wmq_monitorlsnr # # PURPOSE: # This script tests the operation of a particular mq listener. # # ARGUMENTS: Queue manager # # FLAGS: # u) MQU name # m) QM name # l) LSNR name # RETURNS: # An exit code is generated by the runmqsc command: # 0 => Either the listener is starting or # the listener is running and responds. Either is OK. # >0 => The listener is not responding and not starting. # # ########################################################################### function monitor_mqlsnr { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # Test the operation of mq listener. # Result is 0 on success, non-zero on error. KLIB_SA_logmsg INFO 2 24 wmq_sa.cat "Monitoring the WebSphere MQ listener %1\$s \ associated with Queue Manager %2\$s" $LSNR $QM echo "DISPLAY LSSTATUS($LSNR)" | /usr/bin/su $MQU -c "/usr/mqm/bin/runmqsc $QM" | grep -qw "STATUS(RUNNING)" RC=$? if (( $RC == 0 )) then # it means, mq listener is running now KLIB_SA_logmsg INFO 2 25 wmq_sa.cat "WebSphere MQ listener %1\$s \ associated with Queue Manager %2\$s is up and running" $LSNR $QM else # mq listener is not running now KLIB_SA_logmsg INFO 2 26 wmq_sa.cat "WebSphere MQ listener %1\$s \ associated with Queue Manager %2\$s is not up and running" $LSNR $QM fi exit $RC } ################## #MAIN ################## # set a standard PATH export PATH="$(/usr/es/sbin/cluster/utilities/cl_get_path all)" [[ "$VERBOSE_LOGGING" == "high" ]] && set -x . /usr/es/sbin/cluster/sa/wmq/sbin/cl_wmq_Globals typeset opt typeset MQU typeset QM typeset LSNR while getopts u:m:l: opt do case $opt in u) # mqm user name. MQU=$OPTARG ;; m) # qm name. QM=$OPTARG ;; l) # lsnr name. LSNR=$OPTARG ;; esac done [[ -z $MQU || -z $QM || -z $LSNR ]] && exit 1 monitor_mqlsnr