This project creates a wrapper executable that can be used to host any executable as an Windows service.
The binaries are available here for download. That’s compiled from this version, and is probably newer.
During your development…
winsw.exefrom the distribution, and rename it to your taste (such as
myapp.xml(see Configuration Syntax for more details)
winsw.exediscovers its configuration.
When there’s a problem, these commands also report an error message to stderr. On a successful completion, these commands do no produce any output and exit with 0.
In addition, you can also run
myapp.exe status to have it print out the current status of the service to stdout. Again, any error encountered during the processing would cause output to be reported to stderr.
All these commands use the same set of exit code to indicate its result.
To support self updating services, winsw offers a mechanism to perform file operations before a service start up. This is often necessary because Windows prevents files from overwritten while it’s in use.
To perform file operations, write a text file (in the UTF-8 encoding) at
myapp.copies (that is, it’s in the same directory as
myapp.xml but with a different file extension), and for each operation add one line:
The success or failure of these operations will be recorded in the event log.
Once done, the
myapp.copies file will be deleted.
If you are interested in joining the project, let me know. I’m always interested in more committers.