3.12. Installing as a System Service

3.12.1. Installing as a Linux Service
3.12.2. Installing as a Windows Service

For the long-term use of Klaros-Test­management it is essential that the application is available immediately after restarting the computer on which it is installed. Depending on the operating system, different measures have to be taken to achieve this.

3.12.1. Installing as a Linux Service

Depending on your Linux distribution system services are launched using different init daemons.

We are providing sample scripts for the most common ones here, SysVInit and systemd.

3.12.1.1. Installing as a SysVInit Service

To start Klaros-Test­management automatically, the startup script shown below should be saved to the /etc/init.d directory as klaros and selected for the appropriate run level. Please refer to the documentation of your linux distribution for details.

The values of the KLAROS_USER and KLAROS_PATH fields must first be replaced with the intended user id and installation path. It is important that the script is executable. This can be ensured with the command chmod a+x klaros.

The service can now be started via service klaros start and stopped via service klaros stop. chkconfig --add klaros enables the start of the service at system boot.

#!/bin/bash
#
#
# This will be ignored by systems that don't use chkconfig.
# chkconfig: 345 98 2
# description: klaros (inside Tomcat, a servlet container)
#
### BEGIN INIT INFO
# Provides:          klaros
# Required-Start:
# Required-Stop:
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: klaros
# Description:       klaros-testmanagement
### END INIT INFO
#
KLAROS_USER=klarosdemo
KLAROS_PATH="/opt/klaros-testmanagement"
/bin/su - "${KLAROS_USER}" -c "${KLAROS_PATH}/bin/catalina.sh $@ >/var/tmp/klaros.log 2>&1"

3.12.1.2. Installing as a Systemd Service

To start Klaros-Test­management automatically the startup script shown below should be saved to the /etc/systemd/system directory as klaros.service .

The values of the User, ExecStart and ExecStop entries must first be replaced with the intended user id and installation path.

The service can now be started via systemctl start klaros and stopped via systemctl stop klaros. systemctl enable klaros enables the start of the service at system boot.

[Unit]
Description=Klaros Testmanagement Service
After=syslog.target network.target

[Service]
Environment="JRE_HOME=/opt/klaros-testmanagement/jre"
Environment="PATH=/opt/klaros-testmanagement/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
Type=forking
User=klaros

ExecStart=/opt/klaros-testmanagement/bin/startup.sh
ExecStop=/opt/klaros-testmanagement/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

3.12.2. Installing as a Windows Service

Under the Windows operating system family the supplied service.bat script can be used to install the Tomcat application server as a Windows service.

Please refer to the official Apache Tomcat 9 Windows service HOW-TO for further details.

[Caution] Changing the Service User Account

Per default, the created Windows service will use the LocalSystem user account to run the Klaros-Test­management application. This setting must be changed in the service account settings to the account of the user you intend to use for running Klaros-Test­management. This change is needed due to the fact that the default location for the .klaros folder will be located in the user account home.

Skipping this vital step will lead to a newly created .klaros home folder in the C:\Windows\System32\systemuser folder (this location may vary with your Windows version in use; newer version may use C:\Windows\system32\config\systemprofile instead). The service then uses the newly created, empty database instead of the database that is used when Klaros-Test­management is started manually.

If you encounter this situation, then shut down the service, delete the .klaros folder in the Windows\System32 folder, change the user account settings of the service and finally restart the service.

[Tip] Adjusting Memory Settings

Depending on the database size and number of parallel users, Klaros-Test­management may require a larger amount of memory than the installer suggests with the provided default values. If you want to change the specified memory settings for an already installed installation you may supply these settings in the tomcat9w administration interface as shown below.

To ensure that indeed the settings of the installed service are changed, add the service name as a command line argument as follows: [path]\Klaros-Testmanagement\bin\Tomcat9w.exe //ES//Tomcat9.

Additional Tomcat Memory Settings

Figure 3.13. Additional Tomcat Memory Settings


[Tip] Additional Settings

The content repository (see Section 3.10.6, “The Content Repository”) requires another setting in the tomcat9w administration interface. Here the parameter -Doak.locksupport=disabled must be added.

Additional Tomcat Settings

Figure 3.14. Additional Tomcat Settings