Kwservice

kwservice administers the Klocwork Servers.

You can manage the Klocwork servers remotely on Unix 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 2023.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 Klocwork Servers, or an individual Klocwork Server.

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

Usage

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

Examples

To check the status of all Klocwork 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 Klocwork 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 Klocwork 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 Klocwork Servers in one step.

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

You can manage the Klocwork 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 Klocwork 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.

Important: 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
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 Klocwork servers and applications. It contains Klocwork server settings and information about integration projects and build analysis runs. It also stores the Klocwork 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 Klocwork Servers.

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

You can manage the Klocwork Servers remotely on Unix 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 Klocwork Servers:

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

To start the Klocwork 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. For information on upgrading, see Upgrading from a previous version.

kwservice stop

Use this command to stop all or individual Klocwork Servers.

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

You can manage the Klocwork 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> stop [<service_name>]

Examples

To stop all Klocwork Servers:

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

To stop the Klocwork Server:

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