docs.unity.cn
    Show / Hide Table of Contents

    Setting up a service for the licensing server

    This task is part of the end-to-end process for setting up the Unity Licensing Server.

    After you've tested the licensing server, you can set up a service to automatically start the licensing server on startup. You can also manually pause, stop, and restart the process.

    Although optional, setting up a service to run the licensing server process is a recommended best practice.

    After you set up this service, be sure to back up the licensing server configuration. See Backing up and restoring.

    Creating a service

    Important

    Use the same service account that you used to set up the server and import the license archive file.

    To create a service for stopping and starting the licensing server, follow the instructions based on your operating system:

    • Linux
    • Windows

    Creating a service on Linux

    The create-service command does the following:

    • Creates a systemd service unit called unity.license.server.service.
    • Configures the service to run under the current non-root user account.
    • Configures the service to start automatically on startup.
    • Starts the service.
    Note

    If the port you choose is already used by another application and the server fails to launch, run the setup command again from the beginning and select a different port. This command requires administrator privileges. Make sure to run this command with elevated privileges by entering sudo in the Terminal.

    1. To create the service, run the following command:

      sudo ./Unity.Licensing.Server create-service
      

      You should see output similar to the following:

      - - - -
      Welcome to Unity Licensing Server create service command line interface.
      This command line interface will help you create Unity.Licensing.Server service.
      - - - -
      
      Creating service for user 'adminuser' ...
      Enabling service to start automatically after (re)boot ... Done
      Starting service ... Done
      unity.licensing.server.service has been successfully created and running.
      
    2. To check the status of the service, run the following command:

      sudo systemctl status unity.licensing.server.service
      

      Look for Active: active running in the output in the Terminal:

    Creating a service on Windows

    The create-service command requires administrator privileges. Before you start, make sure you start the PowerShell window with elevated privileges. You must use an administrator account and a password that isn't blank.

    1. Give the user the right to log on as a service. To assign this right:

      • Search for Local Security Policy in Windows Search and open the policy editor.

      • In the left menu, navigate to Security Settings > Local Policies > User Rights Assignment and select Log on as service.

      • Click Add User or Group.

      • Type the user name in the text box and click Check Names > OK.

      • Click OK.

    2. To create the service, start the PowerShell window with elevated privileges and run the following command:

      .\Unity.Licensing.Server.exe create-service
      
    3. Enter the password of the administrator account that was used to create the service. The create-service command returns output similar to the following:

      - - - -
      Welcome to Unity Licensing Server create service command line interface.
      This command line interface will help you create Unity.Licensing.Server service.
      - - - -
      
      Enter password for user 'HQ\adminuser':  ***********
      Windows service installation successful!
      Service Name = Unity.Licensing.Server
      Description = The Unity Licensing Server is a secure web server to host and
      manage Unity licenses on your local network
      
    4. To check the status of the service, run the following command:

      sc.exe query Unity.Licensing.Server
      

      Look for the STATE information in the output in the PowerShell window:

      SERVICE_NAME: Unity.Licensing.Server
              TYPE               : 10  WIN32_OWN_PROCESS
              STATE              : 4  RUNNING
                                      (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
              WIN32_EXIT_CODE    : 0  (0x0)
              SERVICE_EXIT_CODE  : 0  (0x0)
              CHECKPOINT         : 0x0
              WAIT_HINT          : 0x0
      

    If the STATE value shows anything other than 4 RUNNING, open Windows Services and look for the Unity.Licensing.Server service to manage it.

    Restarting the service

    You can stop or restart the licensing server service using standard operating system commands.

    Note

    If the port you choose is already used by another application and the server fails to launch, run the setup command again from the beginning and select a different port. This operation interrupts the licensing server's availability. Make sure you perform this operation when traffic is typically low or during your organization's maintenance period.

    Follow the instructions based on your operating system:

    • Linux
    • Windows

    Restarting the service on Linux

    1. Run the following command to start or restart the licensing server service:

      sudo systemctl restart unity.licensing.server.service
      
    2. Run the following command to verify that the service is running:

      sudo systemctl status unity.licensing.server.service | grep Active
      

      If the service is running, the output of the status command is similar to the following:

      Active: active (running) since Fri 2020-02-14 16:44:59 EST; 2s ago
      

    Restarting the service on Windows

    1. Run the following command to start or restart the licensing server service:

      sc.exe query Unity.Licensing.Server | findstr /i State
      
    2. If you see STATE : 4 RUNNING in the output, run the following command to stop the service:

      sc.exe stop Unity.Licensing.Server
      
    3. If you see STATE : 1 STOPPED in the output, run the following command to restart the service:

      sc.exe start Unity.Licensing.Server
      
    4. To check the state of the service again, run the following command:

      sc.exe query Unity.Licensing.Server | findstr /i State
      

    When the output shows STATE : 4 RUNNING, you have successfully restarted the service.

    Deleting the service

    If you need to delete the licensing server service, follow the instructions based on your operating system:

    • Linux
    • Windows

    Deleting the service on Linux

    To delete the licensing server service:

    1. Run the following command to stop the service:

      sudo systemctl stop unity.licensing.server.service
      
    2. Run the following command to disable the service and prevent it from running on the next startup:

      sudo systemctl disable unity.licensing.server.service
      
    3. Run the following command to verify that you disabled the service:

      sudo systemctl status unity.licensing.server.service | grep Loaded
      

      If the service is disabled, the output of the status command is similar to the following:

      Loaded: loaded (/etc/systemd/system/unity.licensing.server.service; **disabled**; vendor preset: enabled)
      
    4. Run the following command to delete the service unit:

      sudo rm -rf /etc/systemd/system/unity.licensing.server.service
      
    5. Run the following command to reflect the change:

      sudo systemctl daemon-reload
      

    Deleting the service on Windows

    To delete the licensing server service:

    1. Run the following command to stop the service:

      sc.exe stop Unity.Licensing.Server
      
    2. Run the following command to check the server status:

      sc.exe query Unity.Licensing.Server | findstr /i State
      
    3. If you see STATE : 1 STOPPED in the output, run the following command to delete the service:

      sc.exe delete Unity.Licensing.Server
      

      The following message displays after you delete the service:

      [SC] DeleteService SUCCESS
      

    Next steps

    Proceed to backing up and restoring to continue setting up your licensing server.

    Back to top Copyright © 2023 Unity Technologies
    Generated by DocFX