+

Search Tips | Advanced Search

Starting an MFT agent as a Windows service

We can start an agent as a Windows service so that when you log off Windows, your agent continues running and can receive file transfers.


About this task

On Windows, when you start an agent from the command line, the agent process runs using the user name we used to log on to Windows. When you log off the system, the agent process stops. To prevent the agent stopping, we can configure an agent to run as a Windows service. Running as a Windows service also allows you to configure agents to be started automatically when the Windows environment starts or is restarted.

Complete the following steps to start an agent that runs as a Windows service. We must be running Managed File Transfer on one of the supported Windows versions to run the agent as a Windows service. For the list of supported environments, refer to the System Requirements for IBM MQ .

The exact steps depend on whether you have already created an agent or whether we are creating an agent. Both options are described in the following steps.


Procedure

  1. If we are creating a Managed File Transfer agent, use the fteCreateAgent, fteCreateCDAgent, or fteCreateBridgeAgent command. Specify the -s parameter to run the agent as a Windows service. In the following example, the agent AGENT1 is created, which has an agent queue manager QMGR1. The Windows service runs using a user name of fteuser, which has an associated password ftepassword.
    fteCreateAgent -agentName AGENT1 -agentQMgr QMGR1 -s -su fteuser -sp ftepassword
    

    We can optionally specify a name for the service after the -s parameter. If we do not specify a name, the service is named mqmftAgentAGENTQMGR, where AGENT is the agent name you specified and QMGR is your agent queue manager name. In this example, the default name for the service is mqmftAgentAGENT1QMGR1.

    Note: The Windows user account that you specify using the -su parameter must have the Log on as a service rights. For information about how to configure this, see Guidance for running an MFT agent or logger as a Windows service.

    For more information, see fteCreateAgent, fteCreateCDAgent: create a Connect:Direct bridge agent, or fteCreateBridgeAgent (create and configure an MFT protocol bridge agent).

  2. If you followed the previous step to create an agent, run the MQSC commands that are generated by the fteCreateAgent, fteCreateCDAgent, or fteCreateBridgeAgent command. These commands create the IBM MQ queues that are needed by the agent. For example, for an agent named AGENT1, an agent queue manager named QMGR1 and a coordination queue manager named COORDQMGR1, run the following command:
    runmqsc QMGR1 MQ_DATA_PATH\mqft\config\COORDQMGR1\agents\AGENT1\AGENT1_create.mqsc
  3. If you did not follow the previous steps to create an agent and instead want to configure an existing agent to run as a Windows service, first stop your agent if it is running, and then modify its configuration.
    1. The following example uses an agent named AGENT1. Run the following command:
      fteStopAgent AGENT1
    2. Use the fteModifyAgent command to configure the agent to run as a Windows service:
      fteModifyAgent -agentName AGENT1 -s -su fteuser -sp ftepassword
      For more information, see fteModifyAgent: run an MFT agent as a Windows service.

  4. Start your agent using the fteStartAgent command. Alternatively, we can use the Windows Services tool, which is available from Administrative Tools in the Control Panel, selected from the Windows desktop start menu, to start the service.
    fteStartAgent AGENT1
    

    The service continues to run even if you log off Windows. To ensure that the service also restarts when Windows restarts after a shutdown, the Startup Type field in the Windows Services tool is set to Automatic by default. Change this to Manual if we do not want the service to restart when Windows restarts.

  5. Optional: To stop the agent, either use the fteStopAgent command or use the Windows Services tool. For example, from the command line, run the following command:
    fteStopAgent AGENT1
    

    • When you run the fteStopAgent command as a service, the command always runs using the -i parameter regardless of whether you specified this parameter. The -i parameter stops the agent immediately without completing any transfers that are in progress. This is caused by a limitation of the Windows service.


What to do next

If we have problems starting your Windows service, see Guidance for running an MFT agent or logger as a Windows service. This topic also describes the location of the Windows service log files. Parent topic: Starting an MFT agent


Related tasks


Related information

Last updated: 2020-10-04