1
0
mirror of https://github.com/winsw/winsw.git synced 2024-11-28 10:25:02 +02:00
A wrapper executable that can run any executable as a Windows service, in a permissive license.
Go to file
2023-01-30 12:52:56 +08:00
.github Update Node.js packages (#1002) 2023-01-29 15:55:49 +08:00
docs Update xml-config-file.md (#875) 2023-01-29 16:56:39 +08:00
eng Upgrade to .NET 7 (#1001) 2023-01-29 00:27:45 +08:00
samples Update serviceaccount field in sample complete.xml (#780) 2023-01-29 16:38:44 +08:00
src Bump System.Reflection.Metadata from 5.0.0 to 7.0.0 (#981) 2023-01-29 15:56:04 +08:00
.gitattributes Add .gitattributes 2020-07-20 22:57:25 -07:00
.gitignore Remove strong name signing 2020-04-16 12:19:59 +08:00
CONTRIBUTING.md Revise docs for 3.0.0-alpha.4 (#645) 2020-08-30 08:56:18 +08:00
Directory.Build.props Revert "Revert "Upgrade to .NET 6 (#806)"" (#852) 2021-08-09 11:46:30 +08:00
LICENSE.txt Revise docs for 3.0.0-alpha.2 (#594) 2020-07-28 08:35:18 +08:00
MANIFEST.md Revise docs for 3.0.0-alpha.3 (#608) 2020-08-11 07:54:32 +08:00
README.md Revise docs for 3.0.0-alpha.11 (#1006) 2023-01-30 12:52:56 +08:00
WinSW.nuspec Revise docs for 3.0.0-alpha.7 (#731) 2020-12-24 03:12:15 +08:00

Windows Service Wrapper in a permissive license

Github All Releases GitHub Release NuGet Build Status Deployment Status Gitter License

WinSW wraps and manages any application as a Windows service.

We are actively developing WinSW 3. Please refer to the v2 branch for previous version documentation.

Why?

See the project manifest.

Supported platforms

WinSW 3 can run on Windows platforms with .NET Framework 4.6.1 or later versions installed. For systems without .NET Framework, the project provides native 64-bit and 32-bit executables based on .NET 7.

More executables can be added upon request.

.NET Framework system requirements
Preinstalled since Windows 10, version 1511 and Windows Server 2016.
Installable since Windows 7 SP1 and Windows Server 2008 R2 SP1.

.NET 7 system requirements
Supported since Windows 10, version 1607, Windows Server (Core) 2012 R2 and Nano Server, version 1809.

Download

Latest release and pre-release WinSW binaries are available on GitHub Releases.

Alternative sources:

Get started

Use WinSW as a global tool

  1. Take WinSW.exe or WinSW.zip from the distribution.
  2. Write myapp.xml (see the XML config file specification and samples for more details).
  3. Run winsw install myapp.xml [options] to install the service.
  4. Run winsw start myapp.xml to start the service.
  5. Run winsw status myapp.xml to see if your service is up and running.

Use WinSW as a bundled tool

  1. Take WinSW.exe or WinSW.zip from the distribution, and rename the .exe to your taste (such as myapp.exe).
  2. Write myapp.xml (see the XML config file specification and samples for more details).
  3. Place those two files side by side, because that's how WinSW discovers its co-related configuration.
  4. Run myapp.exe install [options] to install the service.
  5. Run myapp.exe start to start the service.

Sample configuration file

You write the configuration file that defines your service. The example below is a primitive example being used in the Jenkins project:

<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>
  <log mode="roll"></log>
</service>

The full specification of the configuration file is available here. You can find more samples here.

Usage

WinSW is being managed by the XML configuration file.

Your renamed WinSW.exe binary also accepts the following commands:

Command Description
install Installs the service.
uninstall Uninstalls the service.
start Starts the service.
stop Stops the service.
restart Stops and then starts the service.
status Checks the status of the service.
refresh Refreshes the service properties without reinstallation.
customize Customizes the wrapper executable.
dev Experimental commands.

Experimental commands:

Command Description
dev ps Draws the process tree associated with the service.
dev kill Terminates the service if it has stopped responding.
dev list Lists services managed by the current executable.

Most commands require Administrator privileges to execute. WinSW will prompt for UAC in non-elevated sessions.

Documentation

Contributing

Contributions are welcome! See the contributing guidelines for more information.

License

WinSW is licensed under the MIT license.