Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(*) in script not working

Status
Not open for further replies.

visvid

Technical User
Jun 3, 2002
131
GB
Hi wonder if anyone can help, I am trying to either write a script or write a few lines in the cmd line for the following:

I want to check the queue status and channel status on certain MQ channels, and rather than su and type all the cmds, I was trying to find an easy way i could do this I have tried the following, but it keeps bombing out on (*)
ie
while true
su - mqm -c runmqsc <Queue Manager>
dis ql(*)
dis chstatus(*)
end
sleep 60
done

Any ideas why this wil not work either from a simple script or from the cmd line

Regards

visvid
 
Could be that the shell is expanding the * into a list of filenames, which I assume you dont want. Have you tried escaping the * ...

while true
su - mqm -c runmqsc <Queue Manager>
dis ql(\*)
dis chstatus(\*)
end
sleep 60
done

Greg.
 
Greg,

Thanks for the reply, I actually think its the while cmd which does not work with &quot;(*)&quot; , as I was trying just to see if it was that or the fact I was moving into MQ cmds, I have even tried the following:

alias mq='ps -ef|grep &quot;amqzxma0 -m $QUEUEMGR&quot; | grep -v grep ; sleep 2 ; su - mqm -c runmqsc $QUEUEMGR', but that does not work either. If was just a case of working on one box with mq it would be easy but with over 500 unix boxes , i was looking either for an alias to drop in or a whiletrue to monitor mq queues depths,

Regards

visvid
 
Well, you came to the right place, I went through this same scenario the last few months. Here are some bits of how I went about it:

QManager status:
QMGR=`dspmq|awk '{ print$1 }'|cut -c 8-|sed -e 's/)//'`

DLQ name: (for checking depth)
DEADQ=`echo &quot;dis qmgr&quot; | runmqsc | grep DEADQ | awk '{ print $3 }'|cut -c 7-|sed
-e 's/)//'`

Queue depths: ( I listed the queues I wanted to monitor in a file)
LISTLQ=`cat /some/dir/qlistLQ`
for i in $LISTLQ
do
CNT=`echo &quot;dis q($i) curdepth&quot; | runmqsc | grep CUR | awk '{ print $2 }'|cut -c
10-|sed -e 's/)//'`
if [ &quot;$CNT&quot; -ge &quot;$XQLEVEL&quot; ]
then
bla...bla...

Channel Status: (same as above, listed the sender channels in a file)
CHNL=`cat /some/dir/chlist`
for i in $CHNL
do
CHSTAT=`echo &quot;dis chstatus($i)&quot;|runmqsc|grep STATUS|awk '{ print$2 }'|cut -c 8-|
sed -e 's/)//'`
if [ &quot;$CHSTAT&quot; = &quot;RETRYING&quot; ]
then
bla...bla...


IBM Certified Confused - MQSeries
IBM Certified Flabbergasted - AIX 5 pSeries System Administration
 
Thanks forthis, I willtry this when I am next back at work at let you know

Regards

visivd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top