Kwservice

kwservice administers the Validate Servers.

You can manage the servers remotely on Linux with SSH, or on Windows with Windows Services administration. Otherwise, you must issue the start, restart and stop commands locally.

For the remaining kwservice subcommands, the projects_root directory must be visible from the machine you're logged into.

Usage

kwservice [common-options] <subcommand> [options]

Example

kwservice --projects-root C:\Klocwork 2024.3 Server\projects_root start license

Common options

Name (and short name) Description
--help display this help
--projects-root (-r) path to projects_root directory where the servers are running. Mandatory for all kwservice commands.
--verbose print verbose information about program execution, which can help to troubleshoot errors
--version print version information

Examples variables

The examples in this article use the following variables:

  • <service_name> can be one of:
    • database
    • license
    • klocwork
  • <projects_root> is the projects_root where the servers are running

kwservice check

Use the kwservice check command to check the status of all of the Servers, or an individual Server.

If you are running the Servers as Windows Services, which is the default setup, you must use Windows Services administration to start, stop, and check the Servers, instead of kwservice.

Usage

kwservice --projects-root <projects_root> check [<service_name>]

Examples

To check the status of all Servers:

kwservice --projects-root C:\Klocwork\projects_root check

To check the status of the License Server:

kwservice --projects-root C:\Klocwork\projects_root check license 

kwservice get-service-properties

Use the kwservice get-service-properties command to view the host name and port number of the servers.

Usage

kwservice --projects-root <projects_root> get-service-properties <service_name>

Examples

kwservice --projects-root C:\Klocwork\projects_root get-service-properties klocwork

kwservice list-services

Use this command to list the Servers.

Usage

kwservice --projects-root <projects_root> list-services 

Examples

kwservice --projects-root C:\Klocwork\projects_root list-services 

kwservice restart

Use this command to stop and then restart all or individual Servers in one step.

If you are running the Servers as Windows Services, which is the default, you must use Windows Services administration to start, stop, and check the Servers, instead of kwservice.

You can manage the Servers remotely on Unix with SSH, or on Windows with Windows Services administration. Otherwise, you must issue the start, restart, and stop commands servers locally.

Usage

kwservice --projects-root <projects_root> restart [<service_name>] 

Examples

To restart all Servers:

kwservice --projects-root C:\Klocwork\projects_root restart 

To restart the License server:

kwservice --projects-root C:\Klocwork\projects_root restart license 

kwservice set-service-property

Use this command to set properties for the Klocwork servers.

You must stop the relevant server before running this command. See kwservice stop

Usage

kwservice --projects-root <projects_root> set-service-property <service_name> <property> <value> 
  • <service_name> is one of:
    • database
    • license
    • klocwork
  • <property> is one of the properties from the table below
Property Description Default value Applies to these servers
append.license.logging

To append instead of overwrite the <projects root>/logs/license.report.log file when restarting the server, use this property set to "true" in conjunction with the license service.

Example: kwservice set-service-property license append.license.logging true

This setting is needed when running a license server from the configured projects root. It is not used if you configure your projects root to use a license server hosted elsewhere.

   
host the host name of the specified server localhost all
memory The amount of memory available for the server. Must be a valid Java -Xmx value, for example 2G. 1G Tomcat
port the port number used by the specified server License Server: 27000 Database Server: 3306 Klocwork Server: 8080 all

kwservice setup

Use this command to set up and initialize additional projects_root directories.

A single projects_root directory is created automatically during installation.

A projects_root directory is the data location for the servers and applications. It contains server settings and information about integration projects and build analysis runs. It also stores the license file. The default location is <Server_install>/projects_root.

If your project_root directory is not in the default location, you need to specify its location, as well as the location of the additional projects_root you want to create.

If you need to create additional projects_root directories, contact Klocwork Customer Support for more information.

Usage

kwservice --projects-root <new_projects_root> setup [options] 

where:

  • <new_projects_root> is the path to the projects_root you want to create. Note that the parent directory of this directory must already exist.

Important: The maximum length of the path to the projects_root is 68-72 characters, depending on the length of the Database server port number (1-5 digits).

Example 1 (default location used for projects_root)

kwservice --projects-root C:\Klocwork\projects_root_2 setup 

Example 2 (non-default location used for projects_root)

kwservice setup --old-pr C:\mydatabase\projects_root --projects-root C:\mydatabase\projects_root_2 

Options

Name Description
--license <arg> specify the license file. Use this option to copy the specified license file to the new projects_root directory.
--old-pr <arg> specify an existing projects_root directory. Use this option to copy server settings from an existing projects_root.

kwservice start

Use this command to start all or individual Servers.

If you are running the Servers as Windows Services, which is the default setup, you must use Windows Services administration to start, stop, and check the Servers, instead of kwservice.

You can manage the Servers remotely on Linux with SSH, or on Windows with Windows Services administration. Otherwise, you must issue the start, restart, and stop commands on the servers locally.

Usage

kwservice --projects-root <projects_root> start [<service_name>] 

Examples

To start all Servers:

kwservice --projects-root C:\Klocwork\projects_root start 

To start the Validate Server:

kwservice --projects-root C:\Klocwork\projects_root start klocwork 

Note on migrate option

The --migrate option is used to migrate a projects_root from a previous version of Klocwork.

Use this command to migrate your projects_root. Migrating a project will also migrate all the streams nested under it. For supported upgrade paths and specific migration use cases, see Migrate your projects_root directory.

Usage

kwservice start --migrate

Examples

kwservice start --migrate --exclude-projects-file C:/exclude.txt --priority-projects-file C:/priority.txt

Options

Name (and short name) Description
--migrate (-m) migrate projects_root
--exclude-projects-file (-x) <string> specify an exclusion file to exclude projects from migration. Only base projects can be excluded. Individual streams cannot be excluded
--priority-projects-file (-y) <string> specify a priority projects file to prioritize migration order. Only base projects can be prioritized. Individual streams cannot be prioritized

kwservice stop

Use this command to stop all or individual Validate Servers.

If you are running the Servers as Windows Services, which is the default setup, you must use Windows Services administration to start, stop, and check the Servers, instead of kwservice.

You can manage the Servers remotely on Linux with SSH, or on Windows with Windows Services administration. Otherwise, you must issue the start, restart, and stop commands servers locally.

Usage

kwservice --projects-root <projects_root> stop [<service_name>]

Examples

To stop all Servers:

kwservice --projects-root C:\Klocwork\projects_root stop 

To stop the Validate Server:

kwservice --projects-root C:\Klocwork\projects_root stop klocwork