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:

Cargo-deb — Rust/Cargo add-on // Lib.rs supports packaging systemd services:

https://github.com/mmstick/cargo-deb/blob/master/systemd.md

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.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.