ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Messaging and Integration Technologies FAQ » use QMgrname and Status in a script

Post new topic  Reply to topic
 use QMgrname and Status in a script « View previous topic :: View next topic » 
Author Message
Michael Dag
PostPosted: Thu Jan 08, 2004 2:58 pm    Post subject: use QMgrname and Status in a script Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2602
Location: The Netherlands (Amsterdam)

Posted earlier, but can be modified for all kinds of purposes:

How to find out in a script if Qmgr(s) is(are) Running...

On Solaris/AIX:
Code:
#!/usr/bin/ksh
dspmq | grep -v Running | cut -d '(' -f2,3 | cut -d ')' -f1 | while read qmgr
do
  status=`dspmq -m $qmgr | cut -d '(' -f2,3 | cut -d ')' -f2 | cut -d '(' -f2`
  echo QMgr $qmgr is $status
done


On Windows:
Code:
for /F "tokens=1,2,3,4,5,* delims=()" %i IN ('dspmq') DO @IF NOT %l==Running echo QMgr %j is %l


above scripts already ignore Running qmgrs, replace the 'echo ...' statement with the action you want to 'perform'.

Variations
execute a command against all Running QMgrs:
On Solaris/AIX:
Code:
#!/usr/bin/ksh
dspmq | grep Running | cut -d '(' -f2,3 | cut -d ')' -f1 | while read qmgr
do
   command_to_execute $qmgr
done


On Windows:
Code:
for /F "tokens=1,2,3,4,5,* delims=()" %i IN ('dspmq') DO @IF %l==Running command_to_excute %j


execute a command against all QMgrs:
On Solaris/AIX:
Code:
#!/usr/bin/ksh
dspmq | cut -d '(' -f2,3 | cut -d ')' -f1 | while read qmgr
do
   command_to_execute $qmgr
done


On Windows:
Code:
for /F "tokens=1,2,3,4,5,* delims=()" %i IN ('dspmq') DO command_to_excute %j


Michael
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Messaging and Integration Technologies FAQ » use QMgrname and Status in a script
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.