Short display name of the service, which can contain spaces and other characters.
This shouldn't be too long, like `<id>`, and this also needs to be unique among all the services in a given system.
### description
Long human-readable description of the service.
This gets displayed in Windows service manager when the service is selected.
### executable
This element specifies the executable to be launched.
It can be either absolute path, or you can just specify the executable name and let it be searched from `PATH` (although note that the services often run in a different user account and therefore it might have different `PATH` than your shell does.)
This Boolean option enables the delayed start mode if the `Automatic` start mode is defined.
More information about this mode is provided [here](https://blogs.technet.microsoft.com/askperf/2008/02/02/ws2008-startup-processes-and-delayed-automatic-start/).
Please note that this startup mode will not take affect on old Windows versions older than Windows 7 and Windows Server 2008.
Windows service installation may fail in such case.
This element specifies the arguments to be passed to the executable.
Winsw will quote each argument if necessary, so do not put quotes in `<argument>` to avoid double quotation.
```
<argument>arg1</argument>
<argument>arg2</argument>
<argument>arg3</argument>
```
For backward compatibility, `<arguments>` element can be used instead to specify the whole command line in a single element.
### stopargument/stopexecutable
When the service is requested to stop, winsw simply calls [TerminateProcess function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714(v=vs.85).aspx ) API to kill the service instantly.
However, if `<stopargument>` elements are present, winsw will instead launch another process of `<executable>` (or `<stopexecutable>` if that's specified) with the `<stopargument>` arguments, and expects that to initiate the graceful shutdown of the service process.
Winsw will then wait for the two processes to exit on its own, before reporting back to Windows that the service has terminated.
When you use the `<stopargument>`, you must use `<startargument>` instead of `<argument>`. See the complete example below:
```
<executable>catalina.sh</executable>
<startargument>jpda</startargument>
<startargument>run</startargument>
<stopexecutable>catalina.sh</stopexecutable>
<stopargument>stop</stopargument>
```
Note that the name of the element is `startargument` and not `startarguments`.
As such, to specify multiple arguments, you'll specify multiple elements.
When the service is requested to stop, winsw first attempts to [GenerateConsoleCtrlEvent function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms683155%28v=vs.85%29.aspx) (similar to Ctrl+C),
then winsw resorts to calling [TerminateProcess function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.85%29.aspx ) API to kill the service instantly.
For servers requiring authentication some parameters must be specified depending on the type of authentication. Only the basic authentication requires additional sub-parameters. Supported authentication types are:
*`none`: default, must not be specified
*`sspi`: Microsoft [authentication](https://en.wikipedia.org/wiki/Security_Support_Provider_Interface) including Kerberos, NTLM etc.
The parameter “unsecureAuth” is only effective when the transfer protocol is HTTP - unencrypted data transfer. This is a security vulnerability because the credentials are send in clear text! For a SSPI authentication this is not relevant because the authentication tokens are encrypted.
For target servers using the HTTPS transfer protocol it is necessary, that the CA which issued the server certificate is trusted by the client. This is normally the situation when the server ist located in the Internet. When an organisation is using a self issued CA for the intranet this probably is not the case. In this case it is necessary to import the CA to the Certificate MMC of the Windows client. Have a look to the instructions on this [site](https://technet.microsoft.com/en-us/library/cc754841.aspx). The self issued CA must be imported to the Trusted Root Certification Authorities for the computer.
This is another useful building block for developing a self-updating service.
### log
See the "Logging" section above for more details.
### onfailure
This optional repeatable element controls the behaviour when the process launched by winsw fails (i.e., exits with non-zero exit code).
```
<onfailureaction="restart"delay="10 sec"/>
<onfailureaction="restart"delay="20 sec"/>
<onfailureaction="reboot"/>
```
For example, the above configuration causes the service to restart in 10 seconds after the first failure, restart in 20 seconds after the second failure, then Windows will reboot if the service fails one more time.
Each element contains a mandatory `action` attribute, which controls what Windows SCM will do, and optional `delay` attribute, which controls the delay until the action is taken.
The legal values for action are:
*`restart`: restart the service
*`reboot`: reboot Windows
*`none`: do nothing and leave the service stopped
The possible suffix for the delay attribute is sec/secs/min/mins/hour/hours/day/days. If missing, the delay attribute defaults to 0.
If the service keeps failing and it goes beyond the number of `<onfailure>` configured, the last action will be repeated.
Therefore, if you just want to always restart the service automatically, simply specify one `<onfailure>` element like this:
<onfailureaction="restart"/>
### resetfailure
This optional element controls the timing in which Windows SCM resets the failure count.
For example, if you specify `<resetfailure>1 hour</resetfailure>` and your service continues to run longer than one hour, then the failure count is reset to zero.
This affects the behaviour of the failure actions (see `<onfailure>` above).
In other words, this is the duration in which you consider the service has been running successfully.
The security descriptor string for the service in SDDL form.
For more information, see [Security Descriptor Definition Language](https://docs.microsoft.com/windows/win32/secauthz/security-descriptor-definition-language).
To use [(Group) Managed Service Accounts](https://technet.microsoft.com/en-us/library/hh831782.aspx) append `$` to the account name and remove `<password>` element:
See the MSDN article [ProcessPriorityClass Enumeration](http://msdn.microsoft.com/en-us/library/system.diagnostics.processpriorityclass%28v=vs.110%29.aspx) for details.