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 » General Discussion » Joining runmqsc and setmqaut into one script.

Post new topic  Reply to topic
 Joining runmqsc and setmqaut into one script. « View previous topic :: View next topic » 
Author Message
kats
PostPosted: Thu Aug 17, 2006 9:43 am    Post subject: Joining runmqsc and setmqaut into one script. Reply with quote

Voyager

Joined: 20 Apr 2006
Posts: 78

I want to put the script in one piece in a .bat file (WINDOWS platform).

Basically the script has three pieces:

1. runmqsc console "to create MQ object"
2. Setmqaut "to set authority"
3. runmqsc console "to refresh security"


The reason for doing it is to simplify for application that runs this script on thousands of qmgrs.
The sample script is shown underneath:

So if P259997 --> qmgr ; then script is:

runmqsc P259997

define qlocal(Q1)

end

setmqaut -m P259997 -t qmgr -g mqm +allmqi +dsp

setmqaut -m P259997 -n Q1 -t queue -g mqm +alladm +allmqi

dspmqaut -m P259997 -n Q1 -t queue -g mqm

runmqsc P259997

refresh security

end


This script didn't work for me. Could you try. That way you'd know where to exactly rectify!!


Last edited by kats on Thu Aug 17, 2006 10:23 am; edited 3 times in total
Back to top
View user's profile Send private message
oz1ccg
PostPosted: Thu Aug 17, 2006 9:58 am    Post subject: Reply with quote

Yatiri

Joined: 10 Feb 2002
Posts: 628
Location: Denmark

Hmm, this should do the trick :

RSC.cmd:
Code:
echo define qlocal('%2')   > crefile.txt
echo end                    >>crefile.txt

echo refresh security        >Refresh.txt
echo end                    >>Refresh.txt


runmqsc %1 < crefile.txt

setmqaut -m %1 -t qmgr -g %3 +allmqi +dsp
setmqaut -m %1 -n %2 -t queue -g %3 +alladm +allmqi
dspmqaut -m %1 -n %2 -t queue -g %3

runmqsc %1 < Refresh.txt


it's invoked with 3 parms:
RSC qmgr queue group


RSC P259997 Q1 mqm


-- Lock it or Lose it --
_________________
Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
wschutz
PostPosted: Thu Aug 17, 2006 10:34 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

What about:RSC.cmd:
Code:
echo define qlocal('%2')  | runmqsc %1
setmqaut -m %1 -t qmgr -g %3 +allmqi +dsp
setmqaut -m %1 -n %2 -t queue -g %3 +alladm +allmqi
dspmqaut -m %1 -n %2 -t queue -g %3
echo refresh security | runmqsc %1

btw...maybe its just a bad example, but you don't need to give the mqm group any authorities to objects....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Thu Aug 17, 2006 10:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, you don't need to refresh security after running setmqaut.

You only need to refresh security if you change membership of an OS group.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kats
PostPosted: Thu Aug 17, 2006 12:45 pm    Post subject: Reply with quote

Voyager

Joined: 20 Apr 2006
Posts: 78

Thank you Oz1ccg, Wayne and Jeff.

The solution works.

Group mqm is just used as an example though.
Back to top
View user's profile Send private message
kats
PostPosted: Thu Aug 17, 2006 4:07 pm    Post subject: Reply with quote

Voyager

Joined: 20 Apr 2006
Posts: 78

I want to have same object names on all qmgrs.So I guess I don't need to assign variables. I can assign direct values. But all qmgrs are will be having different names ofcourse...that I'll resolve.
Now if I give input like this on qmgr P259997: how can I make it work.


Quote:
echo define chl(ABC.SVRCONN) +
chltype(svrconn) +
trptype(tcp) +
mcauser('MUSR_MQADMIN') +
replace | runmqsc P259997

echo DEFINE QREMOTE ('P259997') +
* ALTDATE (2006-08-16) +
* ALTTIME (15.26.47) +
DESCR(' ') +
PUT(ENABLED) +
DEFPRTY(0) +
DEFPSIST(NO) +
XMITQ(' ') +
RNAME(' ') +
RQMNAME(' ') +
REPLACE | runmqsc P259997

echo DEFINE QALIAS ('QA') +
* ALTDATE (2006-08-16) +
* ALTTIME (14.14.20) +
DESCR(' ') +
PUT(ENABLED) +
DEFPRTY(0) +
DEFPSIST(NO) +
GET(ENABLED) +
TARGQ(' ') +
REPLACE | runmqsc P259997

echo "DEFINE QLOCAL ('Q1') +
* CRDATE ( ) +
* CRTIME ( ) +
* ALTDATE (2006-08-16) +
* ALTTIME (14.14.20) +
DESCR(' ') +
PUT(ENABLED) +
DEFPRTY(0) +
DEFPSIST(NO) +
GET(ENABLED) +
MAXDEPTH(0) +
MAXMSGL(0) +
NOSHARE +
DEFSOPT(EXCL) +
MSGDLVSQ(PRIORITY) +
NOHARDENBO +
USAGE(NORMAL) +
RETINTVL(0) +
BOTHRESH(0) +
BOQNAME(' ') +
QDEPTHHI(0) +
QDEPTHLO(0) +
QDPMAXEV(DISABLED) +
QDPHIEV(DISABLED) +
QDPLOEV(DISABLED) +
QSVCINT(0) +
QSVCIEV(NONE) +
REPLACE" | runmqsc P259997

setmqaut -m P259997 -t qmgr -g mqm +allmqi +dsp
setmqaut -m P259997 -n Q1 -t queue -g nm00 +alladm +allmqi
dspmqaut -m P259997 -n Q1 -t queue -g nm00
echo refresh security | runmqsc P259997
pause
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Aug 17, 2006 5:10 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Most of the options you are specifing for the queue definitions are the defaults, they don't need to be specified.
If you do need to have "long lines", then
(a) pipe the stuff into a file (as in the first code exmaple) or
(b) use a scripting language that allows continuations across line (sorry, I don't know if windows .cmd files allows that)
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
oz1ccg
PostPosted: Thu Aug 17, 2006 10:55 pm    Post subject: Reply with quote

Yatiri

Joined: 10 Feb 2002
Posts: 628
Location: Denmark

When I see this, I'll allways raise the black-flag (racing).

Quote:
echo define chl(ABC.SVRCONN) +
chltype(svrconn) +
trptype(tcp) +
mcauser('MUSR_MQADMIN') +
replace | runmqsc P259997


Because it introduces an security risk, anyone (if windows) connecting to the ABC.SVRCONN channels are getting mqm auth. This means that anybody that are able to install MQClient and t.ex. supportpack MO71 can administrate your queuemanager....

My personal advise is, don't place the "strong" users (MUSR_MQADMIN, mqm,...) on a SVRCONN channel without additional security.

To do this I think you should implement a higher level fo security by using either SSL and/or a security exit.

There are more ways to do this. It's just raising a flag!

-- Lock it or Lose it --
_________________
Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
vennela
PostPosted: Fri Aug 18, 2006 7:41 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Also instead of doing echo you can also do:

For example create a file like mymqsc.txt with contents

define ql(abcd)
define ql(efgh)

Now do
runmqsc QM1 < mymqsc.txt
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kats
PostPosted: Fri Aug 18, 2006 8:15 am    Post subject: Reply with quote

Voyager

Joined: 20 Apr 2006
Posts: 78

oz1ccg, Again I put forth a bad example...But I appreciate your concern over here.

Vennela, I could do that but the concern over there is that I'd have to send two more files along with my script and program the script to pipe in these files. If you look at my original problem, I've to go through runmqsc console twice. Ofcourse it's a workable option. This is more like code give by oz1ccg, that obviates the need of sending addtional files...it makes these files over there itself.

Wayne, your solution can take additional parameters if they are not leading to next line but separated by a space.

Quote:
C:\Program Files\IBM\KATS>echo define channel('ABC') chltype(svrconn) trptype(tcp) descr('For DI Clients') (mcauser'mq0007@kats01') | runmqsc P259997
5724-H72 (C) Copyright IBM Corp. 1994, 2004. ALL RIGHTS RESERVED.
Starting MQSC for queue manager P259997.

1 : define channel('ABC') chltype(svrconn) trptype(tcp) descr('For DI Clients') mcauser('mq0007@kats01')
AMQ8014: WebSphere MQ channel created.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed
.
I've programmed the script to run the defintitions saved by saveqmgr.exe a day before if something goes wrong...and that is a different format.
I was only wondering if I could use your code in that situation as it doesn't end up creating files on target. I guess I had my answer.

Thanks guys for your insightful inputs. I really appreciate it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Joining runmqsc and setmqaut into one 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.