Run VirtServer as Service

Applies to VirtServer 3.19.0, last modified on March 28, 2024
Note:

We've identified a recurring SLM licensing issue where VirtServer when started as an application or run as an operating system service, restarts in the opposite state after system updates. The impacted scenarios include:

  • Started as an application and restarted as-a-service after updates.

  • Started as-a-service and restarted as an application after updates.

  • While this primarily impacts Windows users, there have been reported cases on Linux as well.

In these scenarios, the license tokens are handled differently in the registry during restart, leading to inconsistent results during reinstallation. We advise users to restart VirtServer in the same mode as the original install (either as an application or a service) until further notice. Our team is actively working on resolving this issue, and a fix will be released soon.

A possible way to make VirtServer start automatically is to run it as an operating system service on Windows or daemon on Linux and macOS. This way VirtServer can start even if no user is logged in on the computer where it is installed. You can use this approach if you cannot start VirtServer in other ways.

Services (daemons) are a special type of executables. VirtServer is a console application. One possible way to run it as a service (daemon) is to “convert” it to a service with a special utility like nssm. On Windows, a more preferable way is to use a special service executable that is installed as part of the VirtServer installation. On Linux, you can create special configuration files for running VirtServer as a service. See below.

Licensing

Before you start using VirtServer, you need to activate its license. As services (daemons) often run in non-interactive user sessions, you may be unable to activate your VirtServer license normally, since the activation requires that you enter data. You can use any of the following workarounds:

  • Run VirtServer for the first time from the command line to activate the license, and then run VirtServer as a service.

– or –

To run VirtServer as a Service with a SmartBear ID-based license, please activate or deactivate your SmartBear ID-based license using the following commands:

  • java -jar virtserver-cli-1.15.0.jar -s localhost:9090 -activatelicense -licenseserver http://181.72.180.195:40892 - licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 -licenseissuer SLM
  • java -jar virtserver-cli-1.15.0.jar -s localhost:9090 -deactivatelicense -licenseserver http://181.72.180.195:40892 - licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 -licenseissuer SLM

Please enter your own parameter values as appropriate.

  • -licenseserver http://181.72.180.195:40892 - add the SLM license server address and specify port http://40892 is added as default.

  • -licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 - please enter your access key as provided in your onpremise license portal. Access key is required if authentication is configured.

  • -licenseissuer SLM - this is always required if you are using a SmartBear ID-based license.

Windows

The VirtServer installation program offers an option to install VirtServer as a Windows service. Simply select it in the installation wizard:

Service virtualization: Installing VirtServer as a windows Service

Another option you can select is Autostart Service. If you select it, the operating system will run the service automatically on startup.

Note that to run VirtServer, you need to create a user on it first. If you have not done it yet, the service will not start (you will get error #1067):

Service virtualization: Error on starting VirtServer as a service

So, create a user on VirtServer and then run the service.

After you install VirtServer as a service, it is important to change the user account you use to run this service to the account for which your VirtServer license is activated. To do this, open the operating system’s Services list, right-click the VirtServer Service in the list and select Properties from the context menu. In the subsequent dialog, switch to the Log On tab and specify the user account and password there.

Linux

To automate the start of VirtServer, you may use a system configuration. Below is an explanation of how you can do this in RedHat Linux. In other Linux versions the procedure is similar.

  1. Open a text editor and create the following file in the /etc/systemd/system folder.

    Note: To save the file, you will need write permissions for the /etc/systemd/system directory. So, you may need to start the text editor with the sudo command.

    /etc/systemd/system/virtserver.service

    [Unit]
    Description=VirtServer Service
    After=network.target

    [Service]
    Type=simple
    User=user-name
    ExecStart=/home/user-name/SmartBear/VirtServer-3.19.0.0/bin/virtserver.sh
    Restart=on-abort
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=virtserver

    [Install]
    WantedBy=multi-user.target

    Replace user-name with your user name. It is important to specify the user name you used to activate the VirtServer license.

    Also, you may need to correct the VirtServer folder name if you are using a version different from the one we used above.

  2. Run the following command to enable the VirtServer daemon to start automatically on the system startup:

    sudo systemctl enable virtserver.service

  3. Restart your computer. The operating system should run VirtServer as a service (daemon).

    If you want to run the daemon manually, use a command like this one:

    sudo systemctl start virtserver.service

To run VirtServer, you need to create a user in VirtServer. If you have not done this yet, do this now. VirtServer will not start until you create a user. See Manage VirtServer Users.

In the example above, the lines starting with StandardOutput, StandardError and SyslogIdentifier command the operating system to output VirtServer’s messages to the syslog using the VirtServer identifier. If you want to log VirtServer messages to a file, then do not enter these three lines. Follow these steps:

  1. Create the following file in /etc/rsyslog.d:

    /etc/rsyslog.d/virtserver.conf

    if $programname == 'virtserver' then /var/log/virtserver.log
    if $programname == 'virtserver' then ~

  2. Run sudo systemctl restart rsyslog to reload the configuration.

Note

Please note that ,when running VirtServer as Service and when logged on as local system account, logs will be generated in C:\Windows\.....\logs\. If the logged on user changes to a user account, then logs will be generated in C:\users\...\logs\, based on the logged-in user. You can also use the Diagnostic Log to gather your VirtServer logs and save you having to search your machine. Please see here for how to find and use the diagnostics log.

See Also

Different Ways to Run VirtServer
Admin Tasks

Highlight search results