Skip to content

Commit

Permalink
Merge pull request #47 from prehor/openrc
Browse files Browse the repository at this point in the history
Add support for systems using OpenRC
  • Loading branch information
desbma committed Aug 20, 2023
2 parents f88b502 + 8cb3897 commit ea4e8a1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -147,6 +147,21 @@ Then you need to edit the `HDDFANCONTROL_ARGS` variable in `/etc/conf.d/hddfanco

You can then start the daemon with `sudo systemctl start hddfancontrol`, see its status with `sudo systemctl status hddfancontrol` and enable automatic startup at boot time with `sudo systemctl enable hddfancontrol`.

## OpenRC service

An OpenRC service file is provided to control the daemon easily.
If you installed hddfancontrol from a distribution package, you likely already have it installed, otherwise you can install it from the sources of this repository with:

```
sudo cp ./openrc/hddfancontrol /etc/init.d/
sudo mkdir -p /etc/conf.d
sudo cp ./systemd/hddfancontrol.conf /etc/conf.d/hddfancontrol
```

Then you need to edit the `HDDFANCONTROL_ARGS` variable in `/etc/conf.d/hddfancontrol` to set the parameters (drives, temperature range...).

You can then start the daemon with `sudo rc-service hddfancontrol start`, see its status with `sudo rc-service hddfancontrol status` and enable automatic startup at boot time with `sudo rc-update add hddfancontrol default`.

## License

[GPLv3](https://www.gnu.org/licenses/gpl-3.0-standalone.html)
21 changes: 21 additions & 0 deletions openrc/hddfancontrol
@@ -0,0 +1,21 @@
#!/sbin/openrc-run

description="Adjust the fan speed according to the temperature of the hard drive"

cfgfile="/etc/conf.d/hddfancontrol.conf"
pidfile="/run/$RC_SVCNAME.pid"

command=/usr/bin/hddfancontrol
command_args_background="--background --pid-file $pidfile"

source $cfgfile
command_args_variable="$(echo $RC_SVCNAME | tr [:lower:] [:upper:])_ARGS"
eval command_args=\$$command_args_variable

capabilities="CAP_SYS_RAWIO"

required_files="$cfgfile"

depend() {
after lm_sensors
}

0 comments on commit ea4e8a1

Please sign in to comment.