WinSW.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <!--
  2. MIT License
  3. Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees,
  4. Inc., Oleg Nenashev and other contributors
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in all
  12. copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. SOFTWARE.
  20. -->
  21. <!--
  22. This is a sample configuration of the Windows Service Wrapper.
  23. This configuration file should be placed near the WinSW executable, the name should be the same.
  24. E.g. for myapp.exe the configuration file name should be myapp.xml
  25. You can find more information about configuration options here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
  26. -->
  27. <service>
  28. <!--
  29. SECTION: Mandatory options
  30. All options in other sections are optional
  31. -->
  32. <!-- ID of the service. It should be unique accross the Windows system-->
  33. <id>myapp</id>
  34. <!-- Display name of the service -->
  35. <name>MyApp Service (powered by WinSW)</name>
  36. <!-- Service description -->
  37. <description>This service is a service created from a sample configuration</description>
  38. <!-- Path to the executable, which should be started -->
  39. <executable>%BASE%\myExecutable.exe</executable>
  40. <!--
  41. SECTION: Installation
  42. These options are being used during the installation only.
  43. Their modification will not take affect without the service re-installation.
  44. -->
  45. <!--
  46. OPTION: serviceaccount
  47. Defines account, under which the service should run.
  48. -->
  49. <!--
  50. <serviceaccount>
  51. <domain>YOURDOMAIN</domain>
  52. <user>useraccount</user>
  53. <password>Pa55w0rd</password>
  54. <allowservicelogon>true</allowservicelogon>
  55. </serviceaccount>
  56. -->
  57. <!--
  58. OPTION: onfailure
  59. Defines a sequence of actions, which should be performed if the managed executable fails.
  60. Supported actions: restart, reboot, none
  61. -->
  62. <!--
  63. <onfailure action="restart" delay="10 sec"/>
  64. <onfailure action="restart" delay="20 sec"/>
  65. <onfailure action="reboot" />
  66. -->
  67. <!--
  68. OPTION: resetfailure
  69. Time, after which the Windows service resets the failure status.
  70. Default value: 1 day
  71. -->
  72. <!--
  73. <resetfailure>1 hour</resetfailure>
  74. -->
  75. <!--
  76. OPTION: securityDescriptor
  77. The security descriptor string for the service in SDDL form.
  78. For more information, see https://docs.microsoft.com/windows/win32/secauthz/security-descriptor-definition-language.
  79. -->
  80. <!--<securityDescriptor></securityDescriptor>-->
  81. <!--
  82. SECTION: Executable management
  83. -->
  84. <!--
  85. OPTION: arguments
  86. Arguments, which should be passed to the executable
  87. -->
  88. <!--
  89. <arguments>-classpath c:\cygwin\home\kohsuke\ws\hello-world\out\production\hello-world test.Main</arguments>
  90. -->
  91. <!--
  92. OPTION: startarguments
  93. Arguments, which should be passed to the executable when it starts
  94. If specified, overrides 'arguments'.
  95. -->
  96. <!--
  97. <startarguments></startarguments>
  98. -->
  99. <!--
  100. OPTION: workingdirectory
  101. If specified, sets the default working directory of the executable
  102. Default value: Directory of the service wrapper executable.
  103. -->
  104. <!--
  105. <workingdirectory>C:\myApp\work</workingdirectory>
  106. -->
  107. <!--
  108. OPTION: priority
  109. Desired process priority.
  110. Possible values: Normal, Idle, High, RealTime, BelowNormal, AboveNormal
  111. Default value: Normal
  112. -->
  113. <priority>Normal</priority>
  114. <!--
  115. OPTION: stoptimeout
  116. Time to wait for the service to gracefully shutdown the executable before we forcibly kill it
  117. Default value: 15 seconds
  118. -->
  119. <stoptimeout>15 sec</stoptimeout>
  120. <!--
  121. OPTION: stopparentprocessfirst
  122. If set, WinSW will terminate the parent process before stopping the children.
  123. Default value: true
  124. -->
  125. <stopparentprocessfirst>true</stopparentprocessfirst>
  126. <!--
  127. OPTION: stopexecutable
  128. Path to an optional executable, which performs shutdown of the service.
  129. This executable will be used if and only if 'stoparguments' are specified.
  130. If 'stoparguments' are defined without this option, 'executable' will be used as a stop executable
  131. -->
  132. <!--
  133. <stopexecutable>%BASE%\stop.exe</stopexecutable>
  134. -->
  135. <!--
  136. OPTION: stoparguments
  137. Additional arguments, which should be passed to the stop executable during termination.
  138. This OPTION also enables termination of the executable via stop executable
  139. -->
  140. <!--
  141. <stoparguments>-stop true</stoparguments>
  142. -->
  143. <!--
  144. SECTION: Service management
  145. -->
  146. <!--
  147. OPTION: startmode
  148. Defines start mode of the service.
  149. Supported modes: Automatic, Manual, Boot, System (latter ones are supported for driver services only)
  150. Default mode: Automatic
  151. -->
  152. <startmode>Automatic</startmode>
  153. <!--
  154. OPTION: delayedAutoStart
  155. Enables the Delayed Automatic Start if 'Automatic' is specified in the 'startmode' field.
  156. See the WinSW documentation to get info about supported platform versions and limitations.
  157. -->
  158. <!--<delayedAutoStart/>-->
  159. <!--
  160. OPTION: depend
  161. Optionally specifies services that must start before this service starts.
  162. -->
  163. <!--
  164. <depend>Eventlog</depend>
  165. <depend>W32Time</depend>
  166. -->
  167. <!--
  168. OPTION: waithint
  169. The estimated time required for a pending stop operation.
  170. Before the specified amount of time has elapsed, the service should make its next call to the SetServiceStatus function.
  171. Otherwise the service will be marked as non-responding
  172. Default value: 15 seconds
  173. -->
  174. <waithint>15 sec</waithint>
  175. <!--
  176. OPTION: sleeptime
  177. The time before the service should make its next call to the SetServiceStatus function.
  178. Do not wait longer than the wait hint. A good interval is one-tenth of the wait hint but not less than 1 second and not more than 10 seconds.
  179. Default value: 1 second
  180. -->
  181. <sleeptime>1 sec</sleeptime>
  182. <!--
  183. OPTION: interactive
  184. Indicates the service can interactwith the desktop.
  185. -->
  186. <!--
  187. <interactive/>
  188. -->
  189. <!--
  190. SECTION:Logging
  191. -->
  192. <!--
  193. OPTION: logpath
  194. Sets a custom logging directory for all logs being produced by the service wrapper
  195. Default value: Directory, which contains the executor
  196. -->
  197. <!--
  198. <logpath>%BASE%\logs</logpath>
  199. -->
  200. <!--
  201. OPTION: log
  202. Defines logging mode for logs produced by the executable.
  203. Supported modes:
  204. * append - Rust update the existing log
  205. * none - Do not save executable logs to the disk
  206. * reset - Wipe the log files on startup
  207. * roll - Roll logs based on size
  208. * roll-by-time - Roll logs based on time
  209. * rotate - Rotate logs based on size, (8 logs, 10MB each). This mode is deprecated, use "roll"
  210. Default mode: append
  211. Each mode has different settings.
  212. See https://github.com/kohsuke/winsw/blob/master/doc/loggingAndErrorReporting.md for more details
  213. -->
  214. <log mode="append">
  215. <!--
  216. <setting1/>
  217. <setting2/>
  218. -->
  219. </log>
  220. <!--
  221. SECTION: Environment setup
  222. -->
  223. <!--
  224. OPTION: env
  225. Sets or overrides environment variables.
  226. There may be multiple entries configured on the top level.
  227. -->
  228. <!--
  229. <env name="MY_TOOL_HOME" value="C:\etc\tools\myTool" />
  230. <env name="LM_LICENSE_FILE" value="host1;host2" />
  231. -->
  232. <!--
  233. OPTION: download
  234. List of downloads to be performed by the wrapper before starting
  235. -->
  236. <!--
  237. <download from="http://www.google.com/" to="%BASE%\index.html" />
  238. Download and fail the service startup on Error:
  239. <download from="http://www.nosuchhostexists.com/" to="%BASE%\dummy.html" failOnError="true"/>
  240. An example for unsecure Basic authentication because the connection is not encrypted:
  241. <download from="http://example.com/some.dat" to="%BASE%\some.dat"
  242. auth="basic" unsecureAuth=“true”
  243. username="aUser" password=“aPassw0rd" />
  244. Secure Basic authentication via HTTPS:
  245. <download from="https://example.com/some.dat" to="%BASE%\some.dat"
  246. auth="basic" username="aUser" password="aPassw0rd" />
  247. Secure authentication when the target server and the client are members of the same domain or
  248. the server domain and the client domain belong to the same forest with a trust:
  249. <download from="https://example.com/some.dat" to="%BASE%\some.dat" auth="sspi" />
  250. -->
  251. <!--
  252. SECTION: Other options
  253. -->
  254. <!--
  255. OPTION: beeponshutdown
  256. Indicates the service should beep when finished on shutdown (if it's supported by OS).
  257. -->
  258. <!--
  259. <beeponshutdown/>
  260. -->
  261. <!--
  262. SECTION: Extensions
  263. This configuration section allows specifying custom extensions.
  264. More info is available here: https://github.com/kohsuke/winsw/blob/master/doc/extensions/extensions.md
  265. -->
  266. <!--
  267. <extensions>
  268. Extension 1: id values must be unique
  269. <extension enabled="true" id="extension1" className="winsw.Plugins.SharedDirectoryMapper.SharedDirectoryMapper">
  270. <mapping>
  271. <map enabled="false" label="N:" uncpath="\\UNC"/>
  272. <map enabled="false" label="M:" uncpath="\\UNC2"/>
  273. </mapping>
  274. </extension>
  275. ...
  276. </extensions>
  277. -->
  278. </service>