Rotate files while the service is running.
[nssm.git] / README.txt
index 98cec77..3769d4c 100644 (file)
@@ -53,7 +53,11 @@ Since version 2.19, NSSM can add to the service's environment by setting
 AppEnvironmentExtra in place of or in addition to the srvany-compatible\r
 AppEnvironment.\r
 \r
-Since version 2.22, NSSM can set the managed application's process priority.\r
+Since version 2.22, NSSM can set the managed application's process priority\r
+and CPU affinity.\r
+\r
+Since version 2.22, NSSM can apply an unconditional delay before restarting\r
+an application which has exited.\r
 \r
 Since version 2.22, NSSM can rotate existing output files when redirecting I/O.\r
 \r
@@ -128,6 +132,17 @@ You can change the threshold for the service by setting the number of
 milliseconds as a REG_DWORD value in the registry at\r
 HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppThrottle.\r
 \r
+Alternatively, NSSM can pause for a configurable amount of time before\r
+attempting to restart the application even if it successfully ran for the\r
+amount of time specified by AppThrottle.  NSSM will consult the REG_DWORD value\r
+at HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppRestartDelay\r
+for the number of milliseconds to wait before attempting a restart.  If\r
+AppRestartDelay is set and the application is determined to be subject to\r
+throttling, NSSM will pause the service for whichever is longer of the\r
+configured restart delay and the calculated throttle period.\r
+\r
+If AppRestartDelay is missing or invalid, only throttling will be applied.\r
+\r
 NSSM will look in the registry under\r
 HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppExit for\r
 string (REG_EXPAND_SZ) values corresponding to the exit code of the application.\r
@@ -167,10 +182,29 @@ Application priority
 NSSM can set the priority class of the managed application.  NSSM will look in\r
 the registry under HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\r
 for the REG_DWORD entry AppPriority.  Valid values correspond to arguments to\r
-SetProcessPriorityClass().  If AppPriority() is missing or invalid the\r
+SetPriorityClass().  If AppPriority() is missing or invalid the\r
 application will be launched with normal priority.\r
 \r
 \r
+Processor affinity\r
+------------------\r
+NSSM can set the CPU affinity of the managed application.  NSSM will look in\r
+the registry under HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\r
+for the REG_SZ entry AppAffinity.   It should specify a comma-separated listed\r
+of zero-indexed processor IDs.  A range of processors may optionally be\r
+specified with a dash.  No other characters are allowed in the string.\r
+\r
+For example, to specify the first; second; third and fifth CPUs, an appropriate\r
+AppAffinity would be 0-2,4.\r
+\r
+If AppAffinity is missing or invalid, NSSM will not attempt to restrict the\r
+application to specific CPUs.\r
+\r
+Note that the 64-bit version of NSSM can configure a maximum of 64 CPUs in this\r
+way and that the 32-bit version can configure a maxium of 32 CPUs even when\r
+running on 64-bit Windows.\r
+\r
+\r
 Stopping the service\r
 --------------------\r
 When stopping a service NSSM will attempt several different methods of killing\r
@@ -280,6 +314,15 @@ Rotation is independent of the CreateFile() parameters used to open the files.
 They will be rotated regardless of whether NSSM would otherwise have appended\r
 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
+value.\r
+\r
+Note that online rotation requires NSSM to intercept the application's I/O\r
+and create the output files on its behalf.  This is more complex and\r
+error-prone than simply redirecting the I/O streams before launching the\r
+application.  Therefore online rotation is not enabled by default.\r
+\r
 \r
 Environment variables\r
 ---------------------\r
@@ -511,6 +554,10 @@ To configure the server to log to a file:
 \r
     nssm set UT2004 AppStdout c:\games\ut2004\service.log\r
 \r
+To restrict the server to a single CPU:\r
+\r
+    nssm set UT2004 AppAffinity 0\r
+\r
 To remove the server:\r
 \r
     nssm remove UT2004 confirm\r
@@ -542,7 +589,8 @@ Thanks to Joel Reingold for spotting a command line truncation bug.
 Thanks to Arve Knudsen for spotting that child processes of the monitored\r
 application could be left running on service shutdown, and that a missing\r
 registry value for AppDirectory confused NSSM.\r
-Thanks to Peter Wagemans and Laszlo Keresztfalvi for suggesting throttling restarts.\r
+Thanks to Peter Wagemans and Laszlo Keresztfalvi for suggesting throttling\r
+restarts.\r
 Thanks to Eugene Lifshitz for finding an edge case in CreateProcess() and for\r
 advising how to build messages.mc correctly in paths containing spaces.\r
 Thanks to Rob Sharp for pointing out that NSSM did not respect the\r
@@ -554,12 +602,16 @@ the default language when the user's display language was not translated.
 Thanks to Riccardo Gusmeroli 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 prompt.\r
+Thanks to Brian Baxter for suggesting how to escape quotes from the command\r
+prompt.\r
 Thanks to Russ Holmann for suggesting that the shutdown timeout be configurable.\r
 Thanks to Paul Spause for spotting a bug with default registry entries.\r
 Thanks to BUGHUNTER for spotting more GUI bugs.\r
 Thanks to Doug Watson for suggesting file rotation.\r
 Thanks to Арслан Сайдуганов for suggesting setting process priority.\r
+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
 \r
 Licence\r
 -------\r