Revamped environment variables again.
[nssm.git] / README.txt
index 3769d4c..85bf62e 100644 (file)
@@ -288,6 +288,13 @@ AppStderr to the same path, eg C:\Users\Public\service.log, and it should
 work.  Remember, however, that the path must be accessible to the user\r
 running the service.\r
 \r
+Note that if you set AppStdout and/or AppStderr, applications which attempt\r
+to read stdin will fail due to a combination of factors including the way I/O\r
+redirection is configured on Windows and how a console application starts in\r
+a service context.  NSSM can fake a stdin stream so that applications can\r
+still work when they would otherwise exit when at end of file on stdin.  Set\r
+AppStdin to "|" (a single pipe character) to invoke the fake stdin.\r
+\r
 \r
 File rotation\r
 -------------\r
@@ -315,7 +322,17 @@ They will be rotated regardless of whether NSSM would otherwise have appended
 or replaced them.\r
 \r
 NSSM can also rotate files which hit the configured size threshold while the\r
-service is running.  To enable this feature, set AppRotateOnline to a non-zero\r
+service is running.  Additionally, you can trigger an on-demand rotation by\r
+running the command\r
+\r
+    nssm rotate <servicename>\r
+\r
+On-demand rotations will happen after the next line of data is read from\r
+the managed application, regardless of the value of AppRotateBytes. Be aware\r
+that if the application is not particularly verbose the rotation may not\r
+happen for some time.\r
+\r
+To enable online and on-demand rotation, set AppRotateOnline to a non-zero\r
 value.\r
 \r
 Note that online rotation requires NSSM to intercept the application's I/O\r
@@ -337,7 +354,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
@@ -504,6 +547,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
@@ -612,6 +657,8 @@ 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
 \r
 Licence\r
 -------\r