Create a service with Rust

Hello everyone!
I have a really noob question. Does anybody know a Rust library that allows you to create a service and launch it with systemd?
I'm tempted to create a script that creates a .service file, puts it in /etc/systemd/system and launches it with std::process using the command systemctl. This might work but I'm looking for a more scalable and robust solution.
Thanks for your help :slight_smile:

https://lib.rs/cargo-deb supports packaging systemd services:

1 Like

Thanks for your answer @kornel , but I'm not looking to package a Rust program. I'd rather like my Rust code to build and enable a services for other programs or dockers.

Making a service is just a question of writing a short configuration file that describes how to call your executable.