Using a command service object

These examples show how to define a command service object to start a program that writes entries to the operating system's system log when a queue manager is started or stopped.

Before you begin

Note: These examples require you to run the DEFINE SERVICE MQSC command. How you do this varies by platform. See Administering IBM® MQ using MQSC commands.
These examples are written with UNIX style path separator characters.

About this task

In the following examples:
  • logger is a sample program provided with IBM MQ that can write entries to the operating system's system log.
  • +QMNAME+ is a token representing the name of the queue manager.

Procedure

  • Define a command service object to start a program that writes entries to the operating system's system log when a queue manager is started or stopped:
    DEFINE SERVICE(S2) +
    CONTROL(QMGR) +
    SERVTYPE(COMMAND) +
    STARTCMD('/usr/bin/logger') +
    STARTARG('Queue manager +QMNAME+ starting') +
    STOPCMD('/usr/bin/logger') +
    STOPARG('Queue manager +QMNAME+ stopping')
    
  • Define a command service object to start a program that writes entries to the operating system's system log only when a queue manager is stopped:
    DEFINE SERVICE(S3) +
    CONTROL(QMGR) +
    SERVTYPE(COMMAND) +
    STOPCMD('/usr/bin/logger') +
    STOPARG('Queue manager +QMNAME+ stopping')