1
1
Fork 0

added logfile to hc4_fancontrol

This commit is contained in:
david 2023-09-26 10:25:54 +02:00
parent 717ea70456
commit 0869e5b5b1
1 changed files with 7 additions and 3 deletions

View File

@ -6,15 +6,16 @@
# Information (don't touch unless you're me)
AUTHOR="david@socialnerds.org"
VERSION="0.2.0"
VERSION="0.2.1"
LICENSE="GPLv3"
# Configuration
THRESHOLD=45000
THRESHOLD=46000
DISTANCE=1000
INTERVAL=30
STEPS=(80 120 160 210 255)
STEPS=(120 160 210 255)
FAN="/sys/class/hwmon/hwmon2/pwm1"
LOGFILE="/var/log/hc4_fancontrol.log"
# Get all temperature readings and return the highest value
function get_temp() {
@ -40,6 +41,9 @@ function set_speed() {
local NEW_SPEED=$1
if [ $CURRENT_SPEED -ne $NEW_SPEED ]; then
echo $NEW_SPEED > $FAN
if [ -n $LOGFILE ]; then
echo "$(date +%Y%m%d-%H%M%S): Temp[$(get_temp)], Speed[$(get_speed)]" >> $LOGFILE
fi
sleep 3
fi
}