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