mtkennerly / shawl

Windows service wrapper for arbitrary commands
MIT License
448 stars 15 forks source link

Example on Integration into Rust App #26

Closed anjomro closed 1 year ago

anjomro commented 1 year ago

Hi, I'd like to use the library to use a rust program as a windows service. As I understand from the readme it should be possible, right?

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.

It would help me a lot if there would be a minimal example of a program that uses this functionality.

Thank you!

mtkennerly commented 1 year ago

Once you have your Rust app compiled into an executable, there's nothing special about the fact that it was written in Rust. Shawl handles any executable the same way.

There are examples in the README for how to use shawl add or sc create to define a service referencing your executable, and then you can start the service as normal.

mtkennerly commented 1 year ago

If you need any help configuring your specific app, let me know how you'd normally start it from the command line, and I can try to help. But you don't need to do anything in the Rust code to integrate with Shawl, since Shawl just uses the app's executable.