Shawl

Build Status Version License: MIT

Shawl is a wrapper for running arbitrary programs as Windows services, written in Rust. It handles the Windows service API for you so that your program only needs to respond to ctrl-C/SIGINT. If you're creating a project that needs to run as a service, simply bundle Shawl with your project, set it as the entry point, and pass the command to run via CLI. Here is an example of creating a service wrapped with Shawl (note that -- separates Shawl's own options from the command that you'd like it to run):

Shawl will inspect the state of your program in order to report the correct status to Windows:

Shawl creates a log file, shawl.log, in the same location as its executable, with both its own messages and the output from the commands that it runs. If anything goes wrong, you can read the log to find out more. You can disable all logging with --no-log, and you can disable just the command logs with --no-log-cmd.

Shawl differs from existing solutions like WinSW and NSSM in that they require running a special install command to prepare the service, which means, for example, that you have to run a CustomAction if you need to install a service in an MSI. With Shawl, you can configure the service however you want, such as with the normal ServiceInstall in an MSI or by running sc create, because Shawl doesn't have any special setup of its own. The shawl add command is just an optional convenience.

Bear in mind that the default account for new services is the Local System account, which has a different PATH environment variable than your user account. If you configure Shawl to run a command like npm start, that means npm needs to be in the Local System account's PATH, or you could also change the account used by the service instead.

Installation

CLI

```console $ shawl --help Wrap arbitrary commands as Windows services

USAGE: shawl.exe shawl.exe

FLAGS: -h, --help Prints help information -V, --version Prints version information

SUBCOMMANDS: add Add a new service help Prints this message or the help of the given subcommand(s) run Run a command as a service; only works when launched by the Windows service manager ```

Development

Please refer to CONTRIBUTING.md.