Pre-General Availability: 2024-09-02

Start the Robot Agent Automatically

If you want the robot agent to automatically start and stop with the Windows operating system, configure the robot agent as a Windows service. This task is optional and applies only if the robot agent runs on a computer or virtual machine with a Windows operating system.

Caution:

If you don't configure the robot agent as a Windows service, you must manually start the robot agent every time the VM restarts.

You use an open-source application called NSSM to configure the robot agent as a Windows service.

  1. Download NSSM to the computer.
    1. Download NSSM from the NSSM website.

      Download the file to the computer that hosts the robot agent, or to a location that you can access from that computer.

    2. Unzip the NSSM file.
    3. Place the NSSM files in a location of your choice on the computer.
  2. Locate the nssm.exe file in the NSSM files, and copy the path to its location.
  3. If the robot agent isn't already running, start the robot agent.
  4. Add the path for the NSSM service to your Windows environment variables.
    1. Open the Settings dialog in Windows.

      For example, open the Windows menu, and type settings.

    2. Next to Related links, select Advanced system settings.

      The System Properties dialog opens.

    3. Select Environment Variables.
      The Environment Variables dialog opens.
    4. In the User variables list, select the Path variable, and select Edit.

      The Edit environment variable dialog opens.

    5. Click New.

      A new row becomes editable in the Edit environment variable dialog.

    6. Paste the path that you copied in a previous step into the row.

      The path shouldn't include nssm.exe file name.

    7. Click OK, and then click OK again.
  5. Update the
    1. Open a command prompt as an administrator.
    2. Enter the following command: nssm install
      The NSSM service installer dialog box appears.
    3. Fill in the fields.
      Tab Fields to enter

      Application

      • Path: Enter the directory of the java.exe file, including the java.exe file name.

      • Startup directory: Enter the directory of the robot agent.

      • Arguments: Enter the command that starts the robot agent, without java at the beginning. If you're not sure, see Start the Robot Agent.

      • Service name: Enter the name of the service as you want it to appear in the list of Windows services. Do not include spaces in the name.

      Sample values for the Application tab. Path: C:\Program Files\Java\jdk-17\bin\java.exe. Startup directory: C:\Users\username\Desktop\robotagent180. Arguments: -jar C:\Users\username\Desktop\robotagent180\orpa-agent-0.1.80.jar. Service name:

      Details

      • Display name: Enter the display name for the service.

      • Description: Enter a description for the service.

      • Startup type: Select Automatic.

      Sample values for the Details tab. Display name: OIC Robot Agent. Description: Startup routing for the robot agent.

      I/O

      • Output (stdout): Select the location for the output files for the service, including the name of the output file.

      • Error (stderr): Select the location for the error files for the service, including the name of the error file.

      Sample values for the I/O tab. Output (stdout): C:\Users\username\Desktop\robotagent180\stdout. Error (stderr): C:\Users\username\Desktop\robotagent180\stderr

      File rotation

      • Select only Rotate files.

      • For Restrict rotation to files bigger than __ bytes, enter 10240 or an appropriate value for your organization.

      Sample values for the File rotation tab: Rotate files is selected, and the value for Restrict rotation to files bigger than is 10240.

      Environment

      Environment variables: Enter the location of the Java home, such as:

      JAVA_HOME="C:\Program Files\Java\jdk-17"

      PATH=%JAVA_HOME%\bin;%PATH%

      Sample value for the Environment tab: JAVA_HOME="C:\Program Files\Java\jdk-17" PATH=%JAVA_HOME%\bin;%PATH%

    4. Click Install service.

      In the command prompt, a message informs you that the service was installed successfully.

  6. Start the service.
    1. Open the Services dialog in Windows.
      For example, open the Windows menu, and type settings.
    2. Find the service you just created. Its name is the Display name that you specified.
    3. Start the service.
  7. To verify that the service started as expected, check the output and error files for any errors.
  8. Repeat the previous steps as needed for other Windows computers or virtual machines for which the robot agent must start automatically.