If interested, here is a procd replacement for the cron job:
Place in /etc/init.d/fan_control
Summary
#!/bin/sh /etc/rc.common
# Copyright (C) 2016-2017 LEDE-Project.org
START=65
STOP=80
USE_PROCD=1
#PROCD_DEBUG=1
boot() {
. /lib/functions.sh
board=$(board_name)
case "$board" in
linksys,mamba)
rc_procd start_service
;;
esac
}
start_service() {
procd_open_instance
procd_set_param command /usr/sbin/fan_monitor -b -a
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
and in /usr/sbin/fan_monitor
Summary
#!/bin/sh
# put in /usr/sbin/fan_monitor
# fan_monitor
# Utility script to monitor temperatures and run fan at 50%/75%/100%
# For Reference the original Belkin specs.
INTERVAL=20 # sleep time in seconds between temp check
FANLOW=127 # low fan speed, set to 0 for off
FANMID=191 # mid fan speed
FANHI=255 # high fan speed
# Set fan to 100% on >= these temperatures
#CPU_HI=80000 # Belkin default is 85
#DDR_HI=58000 # Belkin default is 65
#WIFI_HI=75000 # Belkin default is 105
# Set fan to 75% <= these, otherwise 100%
CPU_MID=80000 # Belkin sets no default
DDR_MID=58000 # Belkin sets no default
WIFI_MID=75000 # Belkin sets no default
# Set fan to 50% <= these temperatures
CPU_LOW=72000 # Belkin default is 80
DDR_LOW=52000 # Belkin default is 60
WIFI_LOW=55000 # Belkin default is 100
cur_pwm=0
new_pwm="$FANHI" # start fan at HI while coming up
fan_set() {
local ppwm
cur_pwm=$1
if [ "$1" -eq $FANLOW ]; then
ppwm="50%"
elif [ "$1" -eq $FANMID ]; then
ppwm="75%"
else
ppwm="100%"
fi
logger -t FAN_MONITOR "Setting Fan to $ppwm"
echo "$1" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
}
# Crank fan on exit
trap "{ logger -t FAN_MONITOR Fan monitor exiting; fan_set $FANHI; logger -t FAN_MONITOR as a precaution; exit; }" SIGINT SIGTERM
# Main fan control loop
while :
do
if [ "$new_pwm" -ne "$cur_pwm" ]
then
fan_set "$new_pwm"
fi
sleep $INTERVAL
cpu=`cat /sys/class/hwmon/hwmon2/temp1_input`
ddr=`cat /sys/class/hwmon/hwmon1/temp1_input`
wifi=`cat /sys/class/hwmon/hwmon1/temp2_input`
if [ "$cpu" -le $CPU_LOW -a "$ddr" -le $DDR_LOW -a "$wifi" -le $WIFI_LOW ]
then
new_pwm="$FANLOW"
elif [ "$cpu" -le $CPU_MID -a "$ddr" -le $DDR_MID -a "$wifi" -le $WIFI_MID ]
then
new_pwm="$FANMID"
else
new_pwm="$FANHI"
fi
done
comment out the fan job in your crontab file, and enable /etc/init.d/fan_control enable; imo better than the other.
Keep meaning to update my github, but sloth gets the better of me