How do I run my rust code as a service in linux?
I have a simple program in rust that has an infinite loop which checks the battery level and alerts when its time to plug in the charger. I need it to run in the background and be accessed by terminal just like ls, ps commands etc..
With absolute ZERO exp in systems programming, I have no idea how to do this.
I've tried daemonize crate, but little to no docs doesn't help a beginner like me.
I've also tried to compile the code and write a unit file and manually registering the service. But no luck. The service doesn't start. It always stops with some error.
My system is Manjaro, and this is not just for me to use. The idea is to make this a cross platform CLI to aid in battery health accross platforms. But for now, I have no idea how to make it a service in linux(and others as well, but small step at a time).