NSSM - the Non-Sucking Service Manager
Description
nssm functions very much like srvany. When started by the system service manager, it looks in the registry for the key HKLM\System\CurrentControlSet\Services\servicename\Parameters and tries to start the program listed in Application, starting in the directory listed in AppDirectory and passing the option flags listed in AppParameters. The observant reader will notice that these values are the same as those which srvany reads, which means that nssm can (almost) be used as a direct replacement.
nssm's behaviour in regards to these registry settings changed in version 2.8. In previous versions nssm would only read the registry once, when the service was started. From version 2.8 onwards the registry is queried each time the monitored application is restarted. You no longer have to restart nssm itself after making changes to the registry.
nssm can be configured to take one of four actions when the application exits, and may even be configured to take different actions based on the application exit code. The possible actions are:
Restart - nssm will attempt to restart the application.
Prior to version 2.2 nssm always did this and it is now the default behaviour if you do not explicitly configure it as described below. Upgrading to a newer version of nssm will not change your service's behaviour.
Ignore - nssm will not attempt to restart the application. The Windows service manager will see your service as still running. This allows you to create a service which runs once at system startup and be sure that it completed successfully by checking that your service is in the running state.
This is srvany's default behaviour, though it probably isn't supposed to be and often isn't what you want, except in the use case described above.
Exit - nssm will exit. The Windows service manager will see your service as stopped. You can configure it to take an action on failure using standard operating system tools.
Suicide - nssm will exit uncleanly, without marking the service as stopped. On Windows versions prior to Vista this is the only way to ensure that service recovery actions are taken, as Exit will not work on older operating systems.
Note that nssm will not suicide if the application exited with code exit code 0, unless you explicitly add an AppExit entry for 0. This is to prevent the service manager from taking failure recovery actions after a graceful application exit.
See the usage notes for instructions on setting one of these actions for your service.
For details on how nssm runs the service and handles application failure, see the source code included in the download and check the flmonitor documentation. nssm is basically an abstraction of flmonitor.
