Skip to content

Commit

Permalink
optional params and temp query mode (#4)
Browse files Browse the repository at this point in the history
* first test

* autobuild dev

* fix

* tests

* further test

* arg array

* optional args and workflow

* test

* test2

* test3

* reverse uno

* Update README.md
  • Loading branch information
fightforlife authored May 8, 2022
1 parent 595b688 commit 229d03f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ name: Publish Docker image
on:
push:
branches:
- 'dev'
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'dev'
- 'master'

# schedule:
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ simple Docker image for hddfancontrol by desbma
https://github.com/desbma/hddfancontrol

This is a docker image which includes the following programs to run **hddfancontrol** by desbma.
- smartmontools - needed for the new --smartctl option, which uses smartmontolls instead of hdparm to spindown drives
- smartmontools - needed for the --smartctl option, which uses smartmontolls instead of hdparm to spindown drives
- hdparm - old way of spinning down drives
- hddtemp - to get hddtemps
- fancontrol - to control PWM fan speed
- lm-sensors - package for pwm sensor detect

### Docker compose
- currently privbiliged mode is used, since I didnt find an easy way to bind the sysfs hwmon instances
- all ENV variables are optional, but hddfancontrol will complain when something important is missing.
```
version: "3"
services:
Expand All @@ -31,8 +32,9 @@ services:
- MAX_TEMP=60
- MIN_FAN=0
- INTERVALL=60
- SPINDOWN_TIME=900
- LOG_PATH=/var/log/hddfancontrol.log
- SPINDOWN_TIME=900 (optional!)
- TEMP_QUERY_MODE=smartctl
- LOG_PATH=/var/log/hddfancontrol.log (optional!)
```

Expand All @@ -41,5 +43,5 @@ services:
- [ ] Find a way to get rid of the priviliged mode and use the devices directly
- [X] incoperate lm-sensors into the container including the kernel modules
- [ ] run and expose hddtemp daemon
- [ ] make way of fetching temp a config
- [X] make way of fetching temp a config

32 changes: 19 additions & 13 deletions start_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
#detect sensors and load modules
sensors-detect --auto | sed -n '/# Chip drivers/,/#----cut here----/{//!p;}' | xargs -n1 modprobe

hddfancontrol -d $DEVICES \
-p $PWM_DEVICES \
--pwm-start-value $PWM_START \
--pwm-stop-value $PWM_STOP \
--min-temp $MIN_TEMP \
--max-temp $MAX_TEMP \
--min-fan-speed-prct $MIN_FAN \
-i $INTERVALL \
--spin-down-time $SPINDOWN_TIME \
--smartctl \
-l $LOG_PATH \
&

#create argument array
declare -a args=()

[[ ! -z $DEVICES ]] && args+=(--drives $DEVICES)
[[ ! -z $PWM_DEVICES ]] && args+=(--pwm $PWM_DEVICES)
[[ ! -z $PWM_START ]] && args+=(--pwm-start-value $PWM_START)
[[ ! -z $PWM_STOP ]] && args+=(--pwm-stop-value $PWM_STOP)
[[ ! -z $MIN_TEMP ]] && args+=(--min-temp $MIN_TEMP)
[[ ! -z $MAX_TEMP ]] && args+=(--max-temp $MAX_TEMP)
[[ ! -z $MIN_FAN ]] && args+=(--min-fan-speed-prct $MIN_FAN)
[[ ! -z $INTERVALL ]] && args+=(-i $INTERVALL)
[[ ! -z $TEMP_QUERY_MODE ]] && args+=(--$TEMP_QUERY_MODE)
[[ ! -z $SPINDOWN_TIME ]] && args+=(--spin-down-time $SPINDOWN_TIME)
[[ ! -z $LOG_PATH ]] && args+=(-l $LOG_PATH)

echo ${args[@]}

hddfancontrol ${args[@]} &

# Wait for any process to exit
wait -n

Expand Down

0 comments on commit 229d03f

Please sign in to comment.