NSSM - the Non-Sucking Service Manager

Managing services from the command line

nssm's core functionality has always been available from the command line.

Service installation

nssm install <servicename>
nssm install <servicename> <program>
nssm install <servicename> <program> [<arguments>]

By default the service's startup directory will be set to the directory containing the program. The startup directory can be overridden after the service has been installed.

nssm set <servicename> AppDirectory <path>

Service removal

nssm remove
nssm remove <servicename>
nssm remove <servicename> confirm

Service management

As of version 2.22, nssm offers basic service management functionality. nssm will also accept a service displayname anywhere that a servicename is expected, since Windows does not allow a service to have a name or display name which conflicts with either the name or display name of another service. Both the service name (also called the service key name) and its display name uniquely identify a service.

Starting and stopping a service

nssm start <servicename>
nssm stop <servicename>
nssm restart <servicename>

Querying a service's status

nssm status <servicename>

Sending controls to services

nssm pause <servicename>
nssm continue <servicename>
nssm rotate <servicename>

nssm rotate triggers on-demand rotation for nssm services with I/O redirection and online rotation enabled. nssm accepts user-defined control 128 as a cue to begin output file rotation. Non-nssm services might respond to control 128 in their own way (or ignore it, or crash).

Service editing

As of version 2.22, all parameters understood by nssm can be queried or configured on the command line. A subset of system parameters can also be queried and, in some cases, modified.

General syntax

Parameters can usually be queried as follows.

nssm get <servicename> <parameter>

Some parameters are ambiguous and require a subparameter. See below.

nssm get <servicename> <parameter> <subparameter>

Parameters can usually be set in a similar way.

nssm set <servicename> <parameter> <value>
nssm set <servicename> <parameter> <subparameter> <value>

Most parameters can be reset to their defaults, which is equivalent to removing the associated registry entry.

nssm reset <servicename> <parameter>
nssm reset <servicename> <parameter> <subparameter>

As a convenience, nssm will accept additional arguments beyond the value required, and concatenate them together, separated by single spaces. Thus the following two invocations are identical:

nssm set <servicename> AppParameters "-classpath C:\Classes"
nssm set <servicename> AppParameters -classpath C:\Classes

Parameters

A parameter is usually a string with the same name as the registry entry which controls the associated functionality. So, for example, the following command sets the startup directory for a service:

nssm set <servicename> AppDirectory <path>

Values

Most parameters are configured by setting the same value as is documented for the associated registry entry. To enable file rotation, for example, you would use the following command:

nssm set <servicename> AppRotation 1

See below for a list of parameters whose values are set differently.

Native parameters

Certain parameters configure properties of the service itself rather than the behaviour of nssm. They too are named after their associated registry values.

Non-standard parameters

Non-standard native parameters