Setting up a service for the licensing server
Set up a service to automatically start the Unity Licensing Server on startup.
Read time 5 minutesLast updated a day ago
This task is part of the end-to-end process for setting up the Unity Licensing Server. After you have 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. Refer to Backing up and restoring.
Creating a service
Before you begin, if you're creating a service for Licensing Server 2.x, you need to decide which of the following account types will run your service:
- NetworkService Account runs the service with limited privileges on the local system.
- User Account runs the service as a specified local or domain user.
Creating a service on Linux
Thecreate-service- Creates a service unit called
systemd.unity.licensing.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.
-
To create the service, run the following command:
Output similar to the following displays (based on a version 2.0 server):sudo ./Unity.Licensing.Server create-service- - - - Welcome to Unity Licensing Server create service command line interface. This command line interface will assist you in creating the Unity.Licensing.Server service. - - - - Creating service for user 'adminuser' ... Setting permissions on service file ... Done Enabling service to start automatically after (re)boot ... Done Starting service ... Done unity.licensing.server.service has been successfully created and running. -
To check the status of the service, run the following command:
Look forsudo systemctl status unity.licensing.server.servicein the output in the Terminal:Active: active running
Console output showing 'Active: active running'
Creating a service on Windows
Thecreate-service-
Give the user the right to log on as a service. To assign this right:
- Search for in Windows Search and open the policy editor.
Local Security Policy - 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.
- Search for
- To create the service, start the PowerShell window with elevated privileges and run the following command:
.\Unity.Licensing.Server.exe create-service
- Enter the password for the account that will be used to run the service. For Licensing Server 2.x, providing a password is necessary only if you choose the option. The
[2] User Accountcommand returns output similar to the following (based on a version 2.0 server):create-service
- - - - Welcome to the Unity Licensing Server create service command-line interface. This command-line interface will assist you in creating the Unity.Licensing.Server service. - - - - Choose the Service Account Type for Installation: - [1] Network Service Account - Runs the service with limited privileges on the local system. - [2] User Account - Runs the service as a specified local or domain user. Select an option: [1] 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.
- To check the status of the service, run the following command:
Look for thesc.exe query Unity.Licensing.Server
STATEIf theSERVICE_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
STATE4 RUNNINGUnity.Licensing.ServerStopping the service
You can stop the licensing server service using standard operating system commands.Stopping the service on Linux
- Open a Terminal window.
- Run the following command:
sudo systemctl stop unity.licensing.server.service
Stopping the service on Windows
- Open the Windows PowerShell as administrator.
- Run the following command:
sc.exe stop Unity.Licensing.Server
Restarting the service
You can restart the licensing server service using standard operating system commands.
Follow the instructions based on your operating system:
Restarting the service on Linux
- Run the following command to start or restart the licensing server service:
sudo systemctl restart unity.licensing.server.service
- Run the following command to verify that the service is running:
If the service is running, the output from the previous command is similar to the following:sudo systemctl status unity.licensing.server.service | grep Active
Active: active (running) since Fri 2020-02-14 16:44:59 EST; 2s ago
Restarting the service on Windows
- Run the following command to start or restart the licensing server service:
sc.exe query Unity.Licensing.Server | findstr /i State
- If the output lists , run the following command to stop the service:
STATE: 4 RUNNING
sc.exe stop Unity.Licensing.Server
- If the output lists , run the following command to restart the service:
STATE: 1 STOPPED
sc.exe start Unity.Licensing.Server
- To check the state of the service again, run the following command:
When the output showssc.exe query Unity.Licensing.Server | findstr /i State
STATE: 4 RUNNINGDeleting the service
If you need to delete the licensing server service, follow the instructions based on your operating system:Deleting the service on Linux
To delete the licensing server service:- Run the following command to stop the service:
sudo systemctl stop unity.licensing.server.service
- Run the following command to disable the service and prevent it from running on the next startup:
sudo systemctl disable unity.licensing.server.service
-
Run the following command to verify that you disabled the service:
If the service is disabled, the output from the previous command is similar to the following:sudo systemctl status unity.licensing.server.service | grep LoadedLoaded: loaded (/etc/systemd/system/unity.licensing.server.service; **disabled**; vendor preset: enabled) - Run the following command to delete the service unit:
sudo rm -rf /etc/systemd/system/unity.licensing.server.service
- Run the following command to reflect the change:
sudo systemctl daemon-reload
Deleting the service on Windows
To delete the licensing server service:- Run the following command to stop the service:
sc.exe stop Unity.Licensing.Server
- Run the following command to check the server status:
sc.exe query Unity.Licensing.Server | findstr /i State
-
If the output lists , run the following command to delete the service:
STATE: 1 STOPPED
The following message displays after you delete the service:sc.exe delete Unity.Licensing.Server[SC] DeleteService SUCCESS