diff --git a/README.md b/README.md index e8113aa..e1a307e 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,21 @@ As an example, the command line below will instruct HDD Fan control to: `hddfancontrol -d /dev/sda /dev/sdb -p /sys/class/hwmon/hwmon1/device/pwm2 /sys/class/hwmon/hwmon1/device/pwm3 --pwm-start-value 200 200 --pwm-stop-value 75 75 --min-fan-speed-prct 10 -i 60 --spin-down-time 7200 -b -l /var/log/hddfancontrol.log` +## Systemd service + +A systemd 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 ./systemd/hddfancontrol.service /usr/lib/systemd/ +sudo mkdir -p /etc/conf.d +sudo cp 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 systemctl start hddfancontrol`, see its status with `sudo systemctl status hddfancontrol` and enable automatic startup at boot time with `sudo systemctl enable hddfancontrol`. + + ## License [GPLv3](https://www.gnu.org/licenses/gpl-3.0-standalone.html) diff --git a/systemd/hddfancontrol.conf b/systemd/hddfancontrol.conf index 1867b62..b455808 100644 --- a/systemd/hddfancontrol.conf +++ b/systemd/hddfancontrol.conf @@ -1,44 +1,9 @@ -# HDD fan control daemon startup arguments - -# -d DRIVE_FILEPATHS [DRIVE_FILEPATHS ...], --drives DRIVE_FILEPATHS [DRIVE_FILEPATHS ...] -# Drive(s) to get temperature from (ie. /dev/sdX) -# (default: None) -# -p FAN_PWM_FILEPATH [FAN_PWM_FILEPATH ...], --pwm FAN_PWM_FILEPATH [FAN_PWM_FILEPATH ...] -# PWM filepath(s) to control fan speed (under /sys) -# (default: None) -# --pwm-start-value FAN_START_VALUE [FAN_START_VALUE ...] -# PWM value (0-255), at which the fan starts moving. Use -# the -t parameter, or run pwmconfig to find this value. -# (default: None) -# --pwm-stop-value FAN_STOP_VALUE [FAN_STOP_VALUE ...] -# PWM value (0-255), at which the fan stop moving. Use -# the -t parameter, or run pwmconfig to find this value. -# Often 20-40 lower than start speed. (default: None) -# --min-temp MIN_TEMP Temperature in Celcius at which the fan(s) will be set -# to minimum speed. (default: 30) -# --max-temp MAX_TEMP Temperature in Celcius at which the fan(s) will be set -# to maximum speed. (default: 50) -# --min-fan-speed-prct MIN_FAN_SPEED_PRCT -# Minimum percentage of full fan speed to set the fan -# to. Never set to 0 unless you have other fans to cool -# down your system, or a case specially designed for -# passive cooling. (default: 20) -# -i INTERVAL_S, --interval INTERVAL_S -# Interval in seconds to check temperature and adjust -# fan speed. (default: 60) -# --spin-down-time SPIN_DOWN_TIME_S -# Interval in seconds after which inactive drives will -# be put to standby state. (default: None) -# -v {warning,normal,debug}, --verbosity {warning,normal,debug} -# Level of logging output (default: normal) -# -l LOG_FILEPATH, --log-file LOG_FILEPATH -# Filepath for log output when using daemon mode, if -# omitted, logging goes to syslog. (default: None) -# --hddtemp-daemon Get drive temperature from hddtemp daemon instead of -# spawning a new process each time temperature is probed -# (default: False) -# --hddtemp-daemon-port HDDTEMP_DAEMON_PORT -# hddtemp daemon port if option --hddtemp-daemon is used -# (default: 7634) +# +# HDD fan control daemon startup arguments, for use as a systemd service +# This file should be located at /etc/conf.d/hddfancontrol +# +# Run 'hddfancontrol -h' to see help about all available arguments. +# Note that the parameters -b/--background, -l/--log-file and --pid-file should not be used here, as systemd handles both daemonization of the process and logging. +# HDDFANCONTROL_ARGS=""