add better daemon support
As I mentioned in issue #36 , I wanted to add support for running the service in the background. This PR does just that, and also adds some cleaner shutdown to the controller. I've added some better logging statements and better --help documentation.
Keep in mind the logger is using the same logger as it used to on the terminal, meaning the rich colours we see may be interpreted weirdly by some editors when viewing them. That said, I feel like if that's an issue for some people, that's the user's editor's issue, and not really our fault. If this is a problem, we may choose to add some configuration to it (as we might want to do with the verbosity, fwiw).
The main changes is that `amdfan daemon` by default now redirects the output to `/var/log/amdfan.log`. This can be reverted with `--no-logfile` or `--stdout`, or a manual logfile can be set with `--logfile=`.
After some discussion with some init-smart people, I decided that it's better to explicitly request the daemon to run in the background with `--background`. By default it will stay running in the foreground, as expected by most init systems.
Some commits include more details
Closes: #36
合并状态:未合并 关闭于 2024-07-30 5 条评论