added logfile to hc4_fancontrol
This commit is contained in:
parent
717ea70456
commit
0869e5b5b1
|
@ -6,15 +6,16 @@
|
||||||
|
|
||||||
# Information (don't touch unless you're me)
|
# Information (don't touch unless you're me)
|
||||||
AUTHOR="david@socialnerds.org"
|
AUTHOR="david@socialnerds.org"
|
||||||
VERSION="0.2.0"
|
VERSION="0.2.1"
|
||||||
LICENSE="GPLv3"
|
LICENSE="GPLv3"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
THRESHOLD=45000
|
THRESHOLD=46000
|
||||||
DISTANCE=1000
|
DISTANCE=1000
|
||||||
INTERVAL=30
|
INTERVAL=30
|
||||||
STEPS=(80 120 160 210 255)
|
STEPS=(120 160 210 255)
|
||||||
FAN="/sys/class/hwmon/hwmon2/pwm1"
|
FAN="/sys/class/hwmon/hwmon2/pwm1"
|
||||||
|
LOGFILE="/var/log/hc4_fancontrol.log"
|
||||||
|
|
||||||
# Get all temperature readings and return the highest value
|
# Get all temperature readings and return the highest value
|
||||||
function get_temp() {
|
function get_temp() {
|
||||||
|
@ -40,6 +41,9 @@ function set_speed() {
|
||||||
local NEW_SPEED=$1
|
local NEW_SPEED=$1
|
||||||
if [ $CURRENT_SPEED -ne $NEW_SPEED ]; then
|
if [ $CURRENT_SPEED -ne $NEW_SPEED ]; then
|
||||||
echo $NEW_SPEED > $FAN
|
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
|
sleep 3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue