2020-08-10 23:54:32 +00:00
|
|
|
# Get started
|
2016-11-24 03:02:30 +00:00
|
|
|
|
|
|
|
This page provides WinSW installation guidelines for different cases.
|
|
|
|
|
2020-08-10 23:54:32 +00:00
|
|
|
## Use WinSW as a global tool
|
|
|
|
|
|
|
|
1. Take *WinSW.exe* or *WinSW.zip* from the distribution.
|
|
|
|
1. Write *myapp.xml* (see the [XML config file specification](xml-config-file.md) for more details)
|
|
|
|
1. Run [`winsw install myapp.xml [options]`](cli-commands.md#install-command) to install the service.
|
|
|
|
1. Run [`winsw start myapp.xml`](cli-commands.md#start-command) to start the service.
|
|
|
|
1. Run [`winsw status myapp.xml`](cli-commands.md#status-command) to see if your service is up and running.
|
|
|
|
|
|
|
|
## Use WinSW as a bundled tool
|
2016-11-25 22:05:05 +00:00
|
|
|
|
|
|
|
In order to setup WinSW, you commonly need to perform the following steps:
|
|
|
|
|
2018-11-29 16:00:00 +00:00
|
|
|
1. Take *WinSW.exe* from the distribution, and rename it to your taste (such as *myapp.exe*)
|
2020-02-03 16:00:00 +00:00
|
|
|
1. Write *myapp.xml* (see the [XML config file specification](xml-config-file.md) for more details)
|
2018-11-29 16:00:00 +00:00
|
|
|
1. Place those two files side by side, because that's how WinSW discovers its configuration.
|
2020-08-10 23:54:32 +00:00
|
|
|
1. Run [`myapp.exe install [options]`](cli-commands.md#install-command) to install the service.
|
|
|
|
1. Run [`myapp.exe start`](cli-commands.md#start-command) to start the service.
|
2016-11-25 22:05:05 +00:00
|
|
|
|
|
|
|
There are some details for each step available below.
|
|
|
|
|
2018-11-27 16:00:00 +00:00
|
|
|
## Installation step details
|
2016-11-25 22:05:05 +00:00
|
|
|
|
2018-11-27 16:00:00 +00:00
|
|
|
### Step 2. Configuration file
|
2016-11-24 03:02:30 +00:00
|
|
|
|
2020-08-10 23:54:32 +00:00
|
|
|
You write the configuration file that defines your service.
|
2016-11-24 03:02:30 +00:00
|
|
|
The example below is a primitive example being used in the Jenkins project:
|
|
|
|
|
2018-11-29 16:00:00 +00:00
|
|
|
```xml
|
|
|
|
<service>
|
|
|
|
<id>jenkins</id>
|
|
|
|
<name>Jenkins</name>
|
|
|
|
<description>This service runs Jenkins continuous integration system.</description>
|
|
|
|
<env name="JENKINS_HOME" value="%BASE%"/>
|
|
|
|
<executable>java</executable>
|
|
|
|
<arguments>-Xrs -Xmx256m -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
|
2020-06-23 02:15:03 +00:00
|
|
|
<log mode="roll"></log>
|
2018-11-29 16:00:00 +00:00
|
|
|
</service>
|
2016-11-24 03:02:30 +00:00
|
|
|
```
|
|
|
|
|
2020-02-03 16:00:00 +00:00
|
|
|
The full specification of the configuration file is available [here](xml-config-file.md).
|
2016-11-25 22:05:05 +00:00
|
|
|
|
2018-11-27 16:00:00 +00:00
|
|
|
### Step 3. Service registration
|
2016-11-24 03:02:30 +00:00
|
|
|
|
2016-11-25 22:10:12 +00:00
|
|
|
The Installer can be also started with the `/p` option.
|
|
|
|
In such case it will prompt for an account name and password, which should be used as a service account.
|