Shawl is a service wrapper for Windows programs, written in Rust. You can
bundle Shawl with your project, set it as the entry point of the service, and
simply pass the command for it to run via CLI, without your program needing to
be service-aware. Shawl's own options and your command are separated by --
:
shawl -- my-app.exe --foo bar
shawl --restart-ok --no-restart-err --stop-timeout 5000 -- my-app.exe
Shawl will inspect the state of your program in order to report the correct status to Windows:
--restart-ok
to restart the command on code 0.--no-restart-err
. If you tell Shawl to not restart it, or if the nonzero
exit happens during a requested service stop, then that exit code will be
reported to Windows as a service-specific error.--stop-timeout
) before
forcibly killing the process if necessary.It differs from existing solutions like WinSW
and NSSM in that their interfaces rely on running a special
install command to prepare the service, which means, for example, that you have
to run a CustomAction
if you're installing with an MSI. With Shawl, you can
configure the service however you want, such as with the normal ServiceInstall
in an MSI, because Shawl doesn't have any special setup of its own.
Prebuilt binaries are available on the releases page.
Commands assume you are using Git Bash on Windows:
rustup target add i686-pc-windows-msvc
rustup target add x86_64-pc-windows-msvc
cargo build --release --target i686-pc-windows-msvc
cargo build --release --target x86_64-pc-windows-msvc
sc create shawl binPath= "$(readlink -f ./target/debug/shawl.exe) -- $(readlink -f ./target/debug/child.exe | cut -c 3-)"
--infinite
to the child to force a timeout on stop.--exit 123
to the child to exit with that code.sc qc shawl
sc start shawl
sc stop shawl
sc delete shawl