MQ

 View Only
Expand all | Collapse all

MQ manager autostart after AWS reboot

  • 1.  MQ manager autostart after AWS reboot

    Posted Thu January 11, 2024 06:20 PM

    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
    ------------------------------


  • 2.  RE: MQ manager autostart after AWS reboot

    Posted Fri January 12, 2024 09:34 AM

    Try this

    #!/bin/bash
    #
    
    dspmq | grep -v Running | cut -d "(" -f 2 | cut -d ")" -f 1 > test.dat
    while read line
    do
    #       echo "line = $line"
            strmqm $line
    done < test.dat
    


    ------------------------------
    Francois Brandelik
    ------------------------------



  • 3.  RE: MQ manager autostart after AWS reboot

    Posted Fri January 12, 2024 10:49 AM

    If using HA qmgrs; it would auto start on the next available host.

    Is the environment you setting it up, just a standalone queue manager?



    ------------------------------
    om prakash
    ------------------------------



  • 4.  RE: MQ manager autostart after AWS reboot

    Posted Fri January 12, 2024 11:21 AM
    Edited by Matheus Francisco Tue January 16, 2024 04:43 AM

    You can run as a systemd service, example:

    [Unit]
    Description=IBM MQ queue manager {QueueManagerName}
    Wants=network-online.target
    After=network.target
    
    
    [Service]
    ExecStart=/opt/mqm/bin/strmqm -x {QueueManagerName}
    ExecStop=/opt/mqm/bin/endmqm -w -s {QueueManagerName}
    SuccessExitStatus=0 5 30 77
    Type=forking
    User=mqm
    Group=mqm
    KillMode=none
    LimitNOFILE=10240
    LimitNPROC=4096
    
    
    [Install]
    WantedBy=multi-user.target

    ------------------------------
    Matheus Francisco
    ------------------------------



  • 5.  RE: MQ manager autostart after AWS reboot

    Posted Fri January 12, 2024 06:18 PM

    Thank you all, This works very well as expected!



    ------------------------------
    Juan Reforme
    ------------------------------



  • 6.  RE: MQ manager autostart after AWS reboot

    Posted Tue January 16, 2024 01:00 AM

    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
    ------------------------------



  • 7.  RE: MQ manager autostart after AWS reboot

    Posted Tue January 16, 2024 08:49 PM