NSSM

From Chorke Wiki
Jump to navigation Jump to search

Non-Sucking Service Manager(NSSM)

nssm is a service helper which doesn't suck. srvany and other service helper programs suck because they don't handle failure of the application running as a service. If you use such a program you may see a service listed as started when in fact the application has died. nssm monitors the running service and will restart it if it dies. With nssm you know that if a service says it's running, it really is. Alternatively, if your application is well-behaved you can configure nssm to absolve all responsibility for restarting it and let Windows take care of recovery actions.

nssm logs its progress to the system Event Log so you can get some idea of why an application isn't behaving as it should.

nssm also features a graphical service installation and removal facility. Prior to version 2.19 it did suck. Now it's quite a bit better.

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.