|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Automated Startup of Websphere Message Brokers V 7.0.0.3 |
« View previous topic :: View next topic » |
Author |
Message
|
tallison |
Posted: Thu Aug 23, 2012 8:23 am Post subject: Automated Startup of Websphere Message Brokers V 7.0.0.3 |
|
|
 Apprentice
Joined: 18 Jun 2002 Posts: 39 Location: Round Rock, Texas
|
Good morning Fellow MB folks....
I am in the process of setting up simple scripts to automate the startup and shutdown of both MQ and Message Broker when an AIX box is shut down.
Scripts are run as root and linked from within inettab.
Here is the problem. I can run these scripts as my unix ID without problem but the id under which the processes are running is my account as I am in the mqbrkrs and mqm groups. When run as root shutdown works fine it is in the startup where it fails. Listed below is my script, any insight or better way to do this?
Thanks
#####################################################################################
## Setup WMB Command Environment
#####################################################################################
#
id=`whoami | awk '{ print $1 }`
mqsi=/opt/IBM/mqsi/$wmbversion/bin
. $mqsi/mqsiprofile
wmb=`mqsilist -a |cut -d "'" -f2 |grep EDR`
#####################################################################################
# Main Routine / Set user and start Message Broker
#####################################################################################
if [ $id != "wmbadm" ];
then
`su - wmbadm -c`
fi
echo $wmb
for i in $wmb
do
`mqsistart $i`
done _________________ Cheers!!
Tony Allison
_________________
MQSeries Certified Specialist
MQSeries Certified Developer
MQSeries Certified Solutions Provider |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Aug 23, 2012 9:34 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You need to use sudo, and a separate mqbrksvcid, for access to all mqsi commands. Don't run mqsi commands from different Ids. Here is why:
Code: |
$ id mqm
uid=1022(mqm) gid=1022(mqm) groups=1(staff),1021(mbbrowse),1023(mqbrkrs),1024(mqmlogs),1093(mqmiles)
|
Code: |
$ id brksvcid
uid=123456789(brksvcid) gid=1023(mqbrkrs)
groups=1020(mqbrowse),1021(mbbrowse),1024(mqmlogs,1071(mqmuser),1093(mqmfiles),1022(mqm)
|
Code: |
$ id myuserid
uid=132456789(myuserid) gid=1034(stduser) groups=1020(mqbrowse),1021(mbbrowse),1023(mqbrkrs),1024(mqmlogs),1071(mqmuser),1093(mqmfiles) |
A global mutex (semaphore) is used to control access to the broker's configuration repository, and it is created by the broker started task at Broker start time.
When the broker starts, it allocates a semaphore and explicitly marks the semaphore's ownership to anyone whose primary group = mqbrkrs. When the semaphore is created by the broker on startup, the Broker runtime tries to set the owning group of the semaphore to "mqbrkrs" by making a getgrnam() system call to get the GID for the "mqbrkrs" group name.
If I (myuserid) tries to lock the semaphore, my attempt will fail since my primary group for my user Id is stduser. If I sudo to the Broker service Id first (brksvcid), then my primary group now does equal the mqbrkrs group, and I am able to lock the semaphore.
Some mqsi commands require access to the repository, as well as the broker and execution group tasks, and therefore the user id that is running the command jobs must have sufficient access permissions (ie. primary user group of mqbrkrs not mqm) to use the semaphore. If the user id does not have sufficient access, the command job abends or timesout when issuing a semctl() system call to gain ownership of the semaphore.
Simply being a member of mqbrkrs is not sufficient. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
tallison |
Posted: Thu Aug 23, 2012 10:45 am Post subject: |
|
|
 Apprentice
Joined: 18 Jun 2002 Posts: 39 Location: Round Rock, Texas
|
Thanks.... I got it figured out....
###################################################################################
## Global Variables
###################################################################################
wmbversion="7.0"
#####################################################################################
## Setup WMB Command Environment
#####################################################################################
#
id=`whoami | awk '{ print $1 }`
mqsi=/opt/IBM/mqsi/$wmbversion/bin
. $mqsi/mqsiprofile
wmb=`mqsilist -a |cut -d "'" -f2 |grep EDR`
#####################################################################################
# Main Routine / Set user and start Message Broker
#####################################################################################
if [ $id != "wmbadm" ];
then
su wmbadm -c ". /var/mqm/scripts/mbst.sh"
fi
Now all of our brokers start under the correct service account when the scripts is run as root. Just had to create a subscript mbst.sh which contains the start routine. _________________ Cheers!!
Tony Allison
_________________
MQSeries Certified Specialist
MQSeries Certified Developer
MQSeries Certified Solutions Provider |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|