Author |
Message
|
brgmo |
Posted: Tue Jun 19, 2007 2:39 am Post subject: Checking the existence of a QMgr |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
Hi All,
Is it possible to check if the queue manager exists or not on the box by using scripts. Like, i want to run a script for creating QMgr and queues. But,before i run this script,i want to check if the queue manager exists. If it exists, i want the script to exit.
Regards
brgmo. |
|
Back to top |
|
 |
wschutz |
Posted: Tue Jun 19, 2007 2:59 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Perl script? ksh script? parse the output of dspmq. _________________ -wayne |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 19, 2007 2:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Yes it is possible and there are many ways to do it. It all depends on your scripting language...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
brgmo |
Posted: Tue Jun 19, 2007 3:08 am Post subject: |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
I am using Linux running under Bourne shell. So, i think probably i will have to use a bourne script to write this script.If someone has already written it, please be kind to share that.
Regards
brgmo. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 19, 2007 3:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
brgmo wrote: |
I am using Linux running under Bourne shell. So, i think probably i will have to use a bourne script to write this script.If someone has already written it, please be kind to share that.
Regards
brgmo. |
We won't do your work for you. You have been given directions... What did you try and what were the results ?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 19, 2007 3:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Quite a while ago, wschutz posted a script that used awk to parse the output of dspmq. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
brgmo |
Posted: Tue Jun 19, 2007 5:37 am Post subject: |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
I think, you are talking about the followinf script written by wschutz.
Quote: |
echo "dis ql(*)" | runmqsc | egrep "QUEUE\(TEST.*\) *TYPE\(QLOCAL\)" | awk '{print $1}' | sed -e "s/QUEUE(\(.*\))/DELETE QLOCAL\(\1\)/" | runmqsc
|
But, it doesn't check for the existence of the queues.
Regards
brgmo. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 19, 2007 5:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You said you wanted to check the existance of the qmgr, not "the queues".
Most of what you need to know about checking the existance of "the queues" is in the MQSC Script Reference manual, which I'm going to assume you've read at this point.
Is there a specific command in that manual that you did not understand? Is there a concept described in that manual that you did not understand?
What have you tried? What happened when you tried it? Did you get an error?
Have you written any bourne shell scripts before? Did you look for documentation and examples on writing bourne shell scripts? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jun 19, 2007 6:52 am Post subject: |
|
|
Guest
|
Take a look at crtmqm control command in the MQ V6 System Admin Guide.
If you or your script attempts to create a new qmgr AND the qmgr already exists, your attempt will fail. If the qmgr doesn't exist, it will be created.
Take a look at runmqsc control command in the same manual.
Now that you have a qmgr - either a pre-existing one or a newly created one, you or your script can attempt to create object definitions.
If you next attempt to create objects on the qmgr AND you specify NOREPLACE, then no existing object definitions will be replaced. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 19, 2007 6:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
bruce2359 wrote: |
If you next attempt to create objects on the qmgr AND you specify NOREPLACE, then no existing object definitions will be replaced. |
NOREPLACE is the default. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Michael Dag |
Posted: Tue Jun 19, 2007 7:10 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 19, 2007 7:16 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
No... your script doesn't use AWK...  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Michael Dag |
Posted: Tue Jun 19, 2007 7:20 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
jefflowrey wrote: |
No... your script doesn't use AWK...  |
sorry must be my last 6 word memory buffer playing tricks on me...  _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
brgmo |
Posted: Tue Jun 19, 2007 7:47 am Post subject: |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
Thanks a lot guys. I have got that working on linux. |
|
Back to top |
|
 |
|