Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run OS Commands with MQ Service object - AMQ8734- Command failed - Program could not be started

Tags:

ibm-mq

I want to run a test command on MQ Server Windows Machine remotely. In order to do that, I use SupportPac MO72 and I can successfully connect remotely to MQ Server with Administrator ID. Now I have MQSC console available and I want to run some OS command with creating SERVICE object. I defined my service as:

DEFINE SERVICE('myService') STARTCMD('C:\Windows\System32\PING.EXE 127.0.0.1') SERVTYPE(SERVER) CONTROL(MANUAL)

The service was created successfully and now I want to start this service, so I typed:

START SERVICE(myService)

But I got this error:

AMQ8734- Command failed - Program could not be started

Any idea?

like image 853
A23149577 Avatar asked Jan 02 '26 02:01

A23149577


1 Answers

There's a combination of things wrong...

  1. Your SERVTYPE(SERVER) is for something which starts running and stays running (and hence whose health is monitored). SERVTYPE(COMMAND) is for something you run and ends. Only a SERVTYPE(SERVER) can be monitored for health but it ought to be long running.

  2. Your startcmd needs to be a binary to launch - just the binary. The STARTARGS need to hold the arguments to the command.

     DEFINE SERVICE('myService') +  
            STARTCMD('C:\Windows\System32\PING.EXE') +  
            STARTARG('127.0.0.1') +  
            SERVTYPE(COMMAND) +  
            CONTROL(MANUAL)  
    

Of course, you might like to see its output - look at the args like STDOUT and STDERR to capture output into a file.

If you want the output to come back to your remote client in a queue it gets a bit more complicated. You would have to capture the output and pipe it through amqsput or some other program to get it onto a queue, then retrieve it. The queue cannot be the same reply queue you are using with MO72 because MO72 would choke on the text, so you would have to use amqsgetc or some other program to fetch the output from the queue.

like image 174
JasonE Avatar answered Jan 04 '26 23:01

JasonE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!