RegisterPowerSettingNotification is unnecessary.
[nssm.git] / README.txt
index 0affeb3..e944340 100644 (file)
@@ -1,5 +1,5 @@
 NSSM: The Non-Sucking Service Manager\r
-Version 2.21, 2013-11-24\r
+Version 2.24, 2014-08-31\r
 \r
 NSSM is a service helper program similar to srvany and cygrunsrv.  It can \r
 start any application as an NT service and will restart the service if it \r
@@ -62,7 +62,7 @@ an application which has exited.
 Since version 2.22, NSSM can rotate existing output files when redirecting I/O.\r
 \r
 Since version 2.22, NSSM can set service display name, description, startup\r
-type and log on details.\r
+type, log on details and dependencies.\r
 \r
 Since version 2.22, NSSM can manage existing services.\r
 \r
@@ -261,6 +261,22 @@ that the timeout applies to each process in the application's process tree,
 so the actual time to shutdown may be longer than the sum of all configured\r
 timeouts if the application spawns multiple subprocesses.\r
 \r
+To skip applying the above stop methods to all processes in the application's\r
+process tree, applying them only to the original application process, set the\r
+HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppKillProcessTree\r
+registry value, which should be of type REG_DWORD, to 0.\r
+\r
+\r
+Console window\r
+--------------\r
+By default, NSSM will create a console window so that applications which\r
+are capable of reading user input can do so - subject to the service being\r
+allowed to interact with the desktop.\r
+\r
+Creation of the console can be suppressed by setting the integer (REG_DWORD)\r
+HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppNoConsole\r
+registry value to 1.\r
+\r
 \r
 I/O redirection\r
 ---------------\r
@@ -310,6 +326,19 @@ If AppRotateBytes is non-zero, a file will not be rotated if it is smaller
 than the given number of bytes.  64-bit file sizes can be handled by setting\r
 a non-zero value of AppRotateBytesHigh.\r
 \r
+If AppRotateDelay is non-zero, NSSM will pause for the given number of\r
+milliseconds after rotation.\r
+\r
+If AppStdoutCopyAndTruncate or AppStdErrCopyAndTruncate are non-zero, the\r
+stdout (or stderr respectively) file will be rotated by first taking a copy\r
+of the file then truncating the original file to zero size.  This allows\r
+NSSM to rotate files which are held open by other processes, preventing the\r
+usual MoveFile() from succeeding.  Note that the copy process may take some\r
+time if the file is large, and will temporarily consume twice as much disk\r
+space as the original file.  Note also that applications reading the log file\r
+may not notice that the file size changed.  Using this option in conjunction\r
+with AppRotateDelay may help in that case.\r
+\r
 Rotation is independent of the CreateFile() parameters used to open the files.\r
 They will be rotated regardless of whether NSSM would otherwise have appended\r
 or replaced them.\r
@@ -347,7 +376,33 @@ environment variables which will be added to the service's environment.
 Each entry in the list should be of the form KEY=VALUE.  It is possible to\r
 omit the VALUE but the = symbol is mandatory.\r
 \r
-srvany only supports AppEnvironment.\r
+Environment variables listed in both AppEnvironment and AppEnvironmentExtra\r
+are subject to normal expansion, so it is possible, for example, to update the\r
+system path by setting "PATH=C:\bin;%PATH%" in AppEnvironmentExtra.  Variables\r
+are expanded in the order in which they appear, so if you want to include the\r
+value of one variable in another variable you should declare the dependency\r
+first.\r
+\r
+Because variables defined in AppEnvironment override the existing\r
+environment it is not possible to refer to any variables which were previously\r
+defined.\r
+\r
+For example, the following AppEnvironment block:\r
+\r
+      PATH=C:\Windows\System32;C:\Windows\r
+      PATH=C:\bin;%PATH%\r
+\r
+Would result in a PATH of "C:\bin;C:\Windows\System32;C:\Windows" as expected.\r
+\r
+Whereas the following AppEnvironment block:\r
+\r
+      PATH=C:\bin;%PATH%\r
+\r
+Would result in a path containing only C:\bin and probably cause the\r
+application to fail to start.\r
+\r
+Most people will want to use AppEnvironmentExtra exclusively.  srvany only\r
+supports AppEnvironment.\r
 \r
 \r
 Managing services using the GUI\r
@@ -457,6 +512,14 @@ managed application.  Valid priorities are as follows:
   IDLE_PRIORITY_CLASS\r
 \r
 \r
+The DependOnGroup and DependOnService parameters are used to query or set\r
+the dependencies for the service.  When setting dependencies, each service\r
+or service group (preceded with the + symbol) should be specified in\r
+separate command line arguments.  For example:\r
+\r
+    nssm set <servicename> DependOnService RpcSs LanmanWorkstation\r
+\r
+\r
 The Name parameter can only be queried, not set.  It returns the service's\r
 registry key name.  This may be useful to know if you take advantage of\r
 the fact that you can substitute the service's display name anywhere where\r
@@ -479,6 +542,13 @@ invocation is valid and will have the expected effect.
 \r
     nssm set <servicename> ObjectName <username> correct horse battery staple\r
 \r
+The following well-known usernames do not need a password.  The password\r
+parameter can be omitted when using them:\r
+\r
+  "LocalSystem" aka "System" aka "NT Authority\System"\r
+  "LocalService" aka "Local Service" aka "NT Authority\Local Service"\r
+  "NetworkService" aka "Network Service" aka "NT Authority\Network Service"\r
+\r
 \r
 The Start parameter is used to query or set the startup type of the service.\r
 Valid service startup types are as follows:\r
@@ -514,6 +584,8 @@ NSSM offers rudimentary service control features.
 \r
     nssm start <servicename>\r
 \r
+    nssm restart <servicename>\r
+\r
     nssm stop <servicename>\r
 \r
     nssm status <servicename>\r
@@ -606,10 +678,10 @@ advising how to build messages.mc correctly in paths containing spaces.
 Thanks to Rob Sharp for pointing out that NSSM did not respect the\r
 AppEnvironment registry value used by srvany.\r
 Thanks to Szymon Nowak for help with Windows 2000 compatibility.\r
-Thanks to François-Régis Tardy for French translation.\r
+Thanks to François-Régis Tardy and Gildas le Nadan for French translation.\r
 Thanks to Emilio Frini for spotting that French was inadvertently set as\r
 the default language when the user's display language was not translated.\r
-Thanks to Riccardo Gusmeroli for Italian translation.\r
+Thanks to Riccardo Gusmeroli and Marco Certelli for Italian translation.\r
 Thanks to Eric Cheldelin for the inspiration to generate a Control-C event\r
 on shutdown.\r
 Thanks to Brian Baxter for suggesting how to escape quotes from the command\r
@@ -622,6 +694,18 @@ Thanks to Арслан Сайдуганов for suggesting setting process prior
 Thanks to Robert Middleton for suggestion and draft implementation of process\r
 affinity support.\r
 Thanks to Andrew RedzMax for suggesting an unconditional restart delay.\r
+Thanks to Bryan Senseman for noticing that applications with redirected stdout\r
+and/or stderr which attempt to read from stdin would fail.\r
+Thanks to Czenda Czendov for help with Visual Studio 2013 and Server 2012R2.\r
+Thanks to Alessandro Gherardi for reporting and draft fix of the bug whereby\r
+the second restart of the application would have a corrupted environment.\r
+Thanks to Hadrien Kohl for suggesting to disable the console window's menu.\r
+Thanks to Allen Vailliencourt for noticing bugs with configuring the service to\r
+run under a local user account.\r
+Thanks to Sam Townsend for noticing a regression with TerminateProcess().\r
+Thanks to Barrett Lewis for suggesting the option to skip terminating the\r
+application's child processes.\r
+Thanks to Miguel Angel Terrón for suggesting copy/truncate rotation.\r
 \r
 Licence\r
 -------\r