README.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. NSSM: The Non-Sucking Service Manager
  2. Version 2.2, 2010-04-04
  3. NSSM is a service helper program similar to srvany and cygrunsrv. It can
  4. start any application as an NT service and will restart the service if it
  5. fails for any reason.
  6. NSSM also has a graphical service installer and remover.
  7. Full documentation can be found online at
  8. http://iain.cx/src/nssm/
  9. Since version 2.0, the GUI can be bypassed by entering all appropriate
  10. options on the command line.
  11. Since version 2.1, NSSM can be compiled for x64 platforms.
  12. Thanks Benjamin Mayrargue.
  13. Since version 2.2, NSSM can be configured to take different actions
  14. based on the exit code of the managed application.
  15. Usage
  16. -----
  17. In the usage notes below, arguments to the program may be written in angle
  18. brackets and/or square brackets. <string> means you must insert the
  19. appropriate string and [<string>] means the string is optional. See the
  20. examples below...
  21. Installation using the GUI
  22. --------------------------
  23. To install a service, run
  24. nssm install <servicename>
  25. You will be prompted to enter the full path to the application you wish
  26. to run and any command line options to pass to that application.
  27. Use the system service manager (services.msc) to control advanced service
  28. properties such as startup method and desktop interaction. NSSM may
  29. support these options at a later time...
  30. Installation using the command line
  31. -----------------------------------
  32. To install a service, run
  33. nssm install <servicename> <application> [<options>]
  34. NSSM will then attempt to install a service which runs the named application
  35. with the given options (if you specified any).
  36. Don't forget to enclose paths in "quotes" if they contain spaces!
  37. Managing the service
  38. --------------------
  39. NSSM will launch the application listed in the registry when you send it a
  40. start signal and will terminate it when you send a stop signal. So far, so
  41. much like srvany. But NSSM is the Non-Sucking service manager and can take
  42. action if/when the application dies.
  43. With no configuration from you, NSSM will try to restart itself if it notices
  44. that the application died but you didn't send it a stop signal. NSSM will
  45. keep trying, pausing 30 seconds between each attempt, until the service is
  46. successfully started or you send it a stop signal.
  47. NSSM will look in the registry under
  48. HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppExit for
  49. string (REG_SZ) values corresponding to the exit code of the application.
  50. If the application exited with code 1, for instance, NSSM will look for a
  51. string value under AppExit called "1" or, if it does not find it, will
  52. fall back to the AppExit (Default) value. You can find out the exit code
  53. for the application by consulting the system event log. NSSM will log the
  54. exit code when the application exits.
  55. Based on the data found in the registry, NSSM will take one of three actions:
  56. If the value data is "Restart" NSSM will try to restart the application as
  57. described above. This is its default behaviour.
  58. If the value data is "Ignore" NSSM will not try to restart the application
  59. but will continue running itself. This emulates the (usually undesirable)
  60. behaviour of srvany. The Windows Services console would show the service
  61. as still running even though the application has exited.
  62. If the value data is "Exit" NSSM will exit. The Windows Services console
  63. would show the service as stopped. If you wish to provide finer-grained
  64. control over service recovery you should use this code and edit the failure
  65. action manually.
  66. Removing services using the GUI
  67. -------------------------------
  68. NSSM can also remove services. Run
  69. nssm remove <servicename>
  70. to remove a service. You will prompted for confirmation before the service
  71. is removed. Try not to remove essential system services...
  72. Removing service using the command line
  73. ---------------------------------------
  74. To remove a service without confirmation from the GUI, run
  75. nssm remove <servicename> confirm
  76. Try not to remove essential system services...
  77. Example usage
  78. -------------
  79. To install an Unreal Tournament server:
  80. nssm install UT2004 c:\games\ut2004\system\ucc.exe server
  81. To remove the server:
  82. nssm remove UT2004 confirm
  83. Building NSSM from source
  84. -------------------------
  85. NSSM is known to compile with Visual Studio 6, Visual Studio 2005 and Visual
  86. Studio 2008.
  87. Credits
  88. -------
  89. Thanks to Benjamin Mayrargue (www.softlion.com) for adding 64-bit support.
  90. Licence
  91. -------
  92. NSSM is public domain. You may unconditionally use it and/or its source code
  93. for any purpose you wish.