MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How to stop all QMs with systemd through a simple execution of systemctl

    Posted Tue August 30, 2022 02:20 PM
    Hi
    Is there an easy way to configure systemd/services in order to stop all QMs with a simple execution of systemctl.
    Like we have it configured now, we have to execute for each QM and we would like to avoid that because we would like to use ansible to stop all QMs.
    Any help would be appreciated.
    Regards

    ------------------------------
    Armand
    IT specialist
    Ibm

    ------------------------------


  • 2.  RE: How to stop all QMs with systemd through a simple execution of systemctl
    Best Answer

    Posted Thu September 01, 2022 10:18 AM
    Hi,

    I think you'll need to write a script that lists the queue managers and then issues strmqm/endmqm commands. This is very basic but it might give you a hint,

    #!/bin/bash
    # Start queue managers
    qmgrs=( $(dspmq | grep -v "Running" | cut -d "(" -f2 | cut -d ")" -f1) )
    for i in "${qmgrs[@]}"
    do
    :
    strmqm "$i"
    done

    #!/bin/bash
    # Stop queue managers
    qmgrs=( $(dspmq | grep "Running" | cut -d "(" -f2 | cut -d ")" -f1) )
    for i in "${qmgrs[@]}"
    do
    :
    endmqm -i "$i"
    done

    ​​

    ------------------------------
    Regards,

    Martin Evans
    IBM MQ Technical Product Manager
    ------------------------------



  • 3.  RE: How to stop all QMs with systemd through a simple execution of systemctl

    Posted Thu September 08, 2022 07:06 AM
    Hi Martin,
    Thanks a lot.
    Your script fits our need. It works perfectly !
    Best regards
    Armand

    ------------------------------
    armand
    IT splecialis
    ibm
    madrid
    ------------------------------