From 0869e5b5b1b984a7f88f5e2b4806585fc5f661cd Mon Sep 17 00:00:00 2001 From: david Date: Tue, 26 Sep 2023 10:25:54 +0200 Subject: [PATCH] added logfile to hc4_fancontrol --- hc4_fancontrol.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hc4_fancontrol.sh b/hc4_fancontrol.sh index abe932a..052cac6 100755 --- a/hc4_fancontrol.sh +++ b/hc4_fancontrol.sh @@ -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 }