<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2008-09-26T23:27:45Z</created-at>
  <description></description>
  <id type="integer">277</id>
  <name>Home</name>
  <number type="integer">6</number>
  <person-id type="integer">1980</person-id>
  <text>This project creates a wrapper executable that can be used to host any executable as an Windows service.

=Download=
&lt;a href=&quot;http://maven.dyndns.org/2/com/sun/winsw/winsw/&quot;&gt;The binaries are available here&lt;/a&gt; for download.

=Usage=
During your development...
# Take &lt;code&gt;winsw.exe&lt;/code&gt; from the distribution, and rename it to your taste (such as &lt;code&gt;myapp.exe&lt;/code&gt;)
# Write &lt;code&gt;myapp.xml&lt;/code&gt; (see [[Configuration Syntax]] for more details)
# Place those two files side by side when you deploy your application, because that's how &lt;code&gt;winsw.exe&lt;/code&gt; discovers its configuration.

At runtime...

* To install a service, run &lt;code&gt;myapp.exe install&lt;/code&gt;
* To start a service, run &lt;code&gt;myapp.exe start&lt;/code&gt;
* To stop a service, run &lt;code&gt;myapp.exe stop&lt;/code&gt;
* To restart a service, run &lt;code&gt;myapp.exe restart&lt;/code&gt;
* To uninstall a service, run &lt;code&gt;myapp.exe uninstall&lt;/code&gt;

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 &lt;code&gt;myapp.exe status&lt;/code&gt; 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 [[ExitCode|exit code]] to indicate its result.

==Deferred File Operations==
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 &lt;code&gt;myapp.copies&lt;/code&gt; (that is, it's in the same directory as &lt;code&gt;myapp.xml&lt;/code&gt; but with a different file extension), and for each operation add one line:

* To move a file, write &quot;src&gt;dst&quot;. If the 'dst' file already exists it will be overwritten.

The success or failure of these operations will be recorded in the event log.

=Contributions Welcome=
If you are interested in joining the project, let me know. I'm always interested in more committers.</text>
  <text-as-html>&lt;p&gt;This project creates a wrapper executable that can be used to host any executable as an Windows service.

&lt;/p&gt;&lt;h1&gt;&lt;a name='Download'&gt;&lt;/a&gt;Download&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;http://maven.dyndns.org/2/com/sun/winsw/winsw/&quot;&gt;The binaries are available here&lt;/a&gt; for download.

&lt;/p&gt;&lt;h1&gt;&lt;a name='Usage'&gt;&lt;/a&gt;Usage&lt;/h1&gt;
&lt;p&gt;During your development...
&lt;/p&gt;&lt;ol&gt;&lt;li&gt; Take &lt;code&gt;winsw.exe&lt;/code&gt; from the distribution, and rename it to your taste (such as &lt;code&gt;myapp.exe&lt;/code&gt;)
&lt;/li&gt;&lt;li&gt; Write &lt;code&gt;myapp.xml&lt;/code&gt; (see &lt;a href='&lt;?url_for_page Configuration Syntax?&gt;' class='internal'&gt;Configuration Syntax&lt;/a&gt; for more details)
&lt;/li&gt;&lt;li&gt; Place those two files side by side when you deploy your application, because that's how &lt;code&gt;winsw.exe&lt;/code&gt; discovers its configuration.
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;
At runtime...

&lt;/p&gt;&lt;ul&gt;&lt;li&gt; To install a service, run &lt;code&gt;myapp.exe install&lt;/code&gt;&lt;/li&gt;&lt;li&gt; To start a service, run &lt;code&gt;myapp.exe start&lt;/code&gt;&lt;/li&gt;&lt;li&gt; To stop a service, run &lt;code&gt;myapp.exe stop&lt;/code&gt;&lt;/li&gt;&lt;li&gt; To restart a service, run &lt;code&gt;myapp.exe restart&lt;/code&gt;&lt;/li&gt;&lt;li&gt; To uninstall a service, run &lt;code&gt;myapp.exe uninstall&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
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.

&lt;/p&gt;&lt;p&gt;In addition, you can also run &lt;code&gt;myapp.exe status&lt;/code&gt; 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.

&lt;/p&gt;&lt;p&gt;All these commands use the same set of &lt;a href='&lt;?url_for_page ExitCode?&gt;' class='internal'&gt;exit code&lt;/a&gt; to indicate its result.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Deferred_File_Operations'&gt;&lt;/a&gt;Deferred File Operations&lt;/h2&gt;
&lt;p&gt;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.

&lt;/p&gt;&lt;p&gt;To perform file operations, write a text file (in the UTF-8 encoding) at &lt;code&gt;myapp.copies&lt;/code&gt; (that is, it's in the same directory as &lt;code&gt;myapp.xml&lt;/code&gt; but with a different file extension), and for each operation add one line:

&lt;/p&gt;&lt;ul&gt;&lt;li&gt; To move a file, write &amp;quot;src&amp;gt;dst&amp;quot;. If the 'dst' file already exists it will be overwritten.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
The success or failure of these operations will be recorded in the event log.

&lt;/p&gt;&lt;h1&gt;&lt;a name='Contributions_Welcome'&gt;&lt;/a&gt;Contributions Welcome&lt;/h1&gt;
&lt;p&gt;If you are interested in joining the project, let me know. I'm always interested in more committers.&lt;/p&gt;</text-as-html>
  <updated-at type="datetime">2008-11-01T22:49:35Z</updated-at>
  <wiki-id type="integer">1085</wiki-id>
</page>
