Linksys WRT1900AC - Error in fan_ctrl.sh - Solved

Recently I noticed from the constant noise of my Linksys WRT1900AC router that the /sbin/fan_ctrl.sh script which is being called from cron was no longer working.
Some troubleshooting made clear that that is because the echo command in the script requires a "-n" option (do not output trailing newline) to function correctly. At least that change makes the script functional again for me.

echo "100" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
-bash: echo: write error: Invalid argument

echo -n "100" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1

Is someone here able to make that change in the git repository?

I don't have that problem on my wrt1900ACv1.

root@AP0:~# echo "100" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
root@AP0:~# echo "10" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
root@AP0:~# echo "ten" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
ash: write error: Invalid argument
root@AP0:~# echo -n "100"  > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
root@AP0:~#

Is your WRT a v1 or v2?
What openwrt version? (I'm running 21.02.3)

This is also on a wrt1900ACv1.
PRETTY_NAME="OpenWrt 21.02.3"
Maybe it is related to the installation of bash?
What is root's shell with you?

If adding ´-n´ would help and doesn't create problems in the default setup it probably could be committed to the production code. I just make the change when updating now. It's not a big problem.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.