Exec as a windows service. How to do it?


#1

I’m trying to run my executable as a windows service. I found daemon-rs (https://crates.io/crates/daemon). It starts my service correctly, but I don’t receive the stop event. I looked, it seems to have a dead-lock… Have you ever used daemon-rs ? Or do you have any other solution to suggest to run an executable as a windows service?
Thanks


#2

One of the fork seems to have a fix for the stop command.


#3

How to use daemon-rs? When I try to run example I found it shows the message and wait. I don’t find any windows service installation.

How to install program as windows service with this library?


#4

If you want to launch your application as a service, you have to create a windows service. You can take a look to https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-createservicew

If you launch your application using daemon-rs as a standalone application, it will not run as a service. daemon-rs can be used to be launched as a service or not.