NSSM: Difference between revisions
No edit summary |
|||
Line 36: | Line 36: | ||
nssm status <servicename> | nssm status <servicename> | ||
== Sending controls to services == | == Sending controls to services == |
Revision as of 01:09, 12 November 2017
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.
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.