Here is how to safely generate an FDC to then go look at the environment dump at the end of the FDC.
Original Message:
Sent: Mon January 22, 2024 03:15 PM
From: Peter Potkay
Subject: MQ manager autostart after AWS reboot
How do we prove to ourselves that the queue manager is in fact running with the system variable we think its running with? I noticed at the bottom of an FDC file the queue manager shows a lot of that. Is there a way to cause the queue manager to eject a harmless info only FDC that we can then look at?
------------------------------
Peter Potkay
Original Message:
Sent: Fri January 19, 2024 03:11 PM
From: Anthony Julian
Subject: MQ manager autostart after AWS reboot
This probably would work. In our case most of our queue managers run on one - and only one of a pair: therefore we needed logic to figure out which host was designated active in the pair.
For configuration management reasons, we wanted to have a single script that would execute on any of our 100+ mq hosts handling both start and stop. In addition, as I remarked under some circumstances endmqm does not stop all the mqm processes on the host so scripting the stop was a requirement.
We chose also to have the same script handle the start/stop ace which simplifies the configuration management even more.
We experimented with systemd templates , but the management was more convoluted and prone to error.
------------------------------
Anthony Julian
Original Message:
Sent: Fri January 19, 2024 10:53 AM
From: Peter Potkay
Subject: MQ manager autostart after AWS reboot
The script that is called by systemd to start the queue manager, couldn't it do something like this to accomplish the "logon" to pick up mqm's ulimits, env variables, etc
runuser -l mqm -c "/opt/mqm/bin/strmqm $QMGR"
------------------------------
Peter Potkay
Original Message:
Sent: Thu January 18, 2024 02:36 PM
From: Anthony Julian
Subject: MQ manager autostart after AWS reboot
- Don't even try to setup MQ systemd as a "user" service unless you really want it to start when the user logs on, and stop when the user exits. . Its an effort in futility.
- When starting MQ from systemd in addition to using a script it is important to setup the ulimits that typically come with a login, but are not provided by systemd since systemd doesnt 'logon':
e.g. mq.service
[Unit]Description=systemd file to start MQWants=centrifydc.serviceAfter=centrifydc.service[Service]# Note in this example the actual location of the script is being purposefully obfuscated # to prevent discovery of infrastructure.ExecStart=/usr/bin/bash -c '<targetdir>/mqnace startmq'ExecStop=/usr/bin/bash -c '<targetdir>/mqnace stopmq'User=mqmType=forkingKillMode=noneLimitAS=infinityLimitCORE=infinityLimitDATA=infinityLimitFSIZE=infinityLimitMEMLOCK=65535LimitMSGQUEUE=819200LimitNOFILE=1048576LimitNPROC=1048576LimitRSS=infinityLimitSIGPENDING=192441LimitSTACK=8192000TimeoutStartSec=3600TimeoutStopSec=240[Install]WantedBy=multi-user.target
3. On our hosts we use a single script that derives the queue manager and broker info from the hostname and handles both the start and stop of mq AND/OR ACE as appropriate.
4. Endmqm may not in some cases be sufficient: there are some processes that dont stop nicely, so the script needs to do something like
# Brutally Killing any remaining mq processes"
for PROCESS in "${MQ_PROCESSES}"
do # Output of kill redirected to /dev/null in case no processes
ps -ef | grep "$PROCESS" | grep -v grep | \
awk '{print $2}'| xargs kill -9
done
------------------------------
Anthony Julian
Original Message:
Sent: Wed January 17, 2024 02:16 AM
From: Mark Taylor
Subject: MQ manager autostart after AWS reboot
I would always go via a script.
That way you can add things like your own logging, perhaps you need to do setmqenv or run from non-default directories, maybe do extra work during shutdown like forcibly killing apps that won't go away on their own ...
------------------------------
Mark Taylor
Winchester
Original Message:
Sent: Tue January 16, 2024 08:48 PM
From: Peter Potkay
Subject: MQ manager autostart after AWS reboot
regarding using systemd to start/stop a MQ Queue Manager, is it better to have systemd call the strmqm / endmqm commands directly, or better to have systemd call a ksh script that then calls startmqm/endmqm and whatever else the script may do?
------------------------------
Peter Potkay
Original Message:
Sent: Tue January 16, 2024 12:59 AM
From: Glenn Baddeley
Subject: MQ manager autostart after AWS reboot
Need code that works?
#!/bin/bash
for qm in $(dspmq | grep -v Running | cut -d'(' -f2 | cut -d')' -f1) ; do
strmqm $qm
done
Preferred solution for Linux is to use systemd.
------------------------------
Glenn Baddeley
Senior Middleware Software Engineer
Coles Supermarkets Australia Pty Ltd
Original Message:
Sent: Thu January 11, 2024 06:20 PM
From: Juan Reforme
Subject: MQ manager autostart after AWS reboot
Hi!
I'm trying to make the MQ Manager autostart after the AWS Instance restart or reboot.
Basically trying to run a bash script when the server start but nothing happens...
#!/bin/bash
# Start queue managers
qmgrs=( $(dspmq | grep -v "Running" | cut -d "(" -f2 | cut -d ")" -f1) )
for i in "${qmgrs[@]}"
do
:
strmqm "$i"
done
Thank you!
------------------------------
Juan Reforme
------------------------------