fancontrol modification to get temp by running a
Hello lmsensors mailing list :-)
Here's a copy of fancontrol 0.67 modified to optionally get fan control temperatures by running a simple command that may be specified in the configuration file.
To integrate with the modified fancontrol, the command should:
a) normally: write the temperature to stdout and set a zero return code.
b) error: write an error message to stderr and set a non-zero return code.
To use this new facility, the FCTEMP specification in the configuration file (normally /etc/fancontrol) is command:<command> where <command> is the command string with any spaces replaced by %20. For example:
FCTEMPS= hwmon1/device/pwm1=command:hddtemp%20-n%20/dev/sda
The command may not include pipelining, redirection, multiple lines etc. It may, of course, run a script.
Best
Charles
=== diff showing changes to fancontrol 0.67 begins === < # Version 0.67+
< #
< # Change history
< # 22jan9 Charles
< # * Added "command:" format and processing for config file FCTEMPS
---
Quoted 1 line
# Version 0.67
281c277,283
< if [[ ${tsens#command:} != $tsens ]]
---
Quoted 7 lines
read tval < ${tsens}
if [ $? -ne 0 ]
then
echo "Error reading temperature from $DIR/$tsens"
restorefans 1
fi
if [ "$SYSFS" = "1" ]283,300d284
< command="${tsens#command:}"
< command="${command//%20/ }"
< tval="$($command 2>&1)"
< if [[ $? -ne 0 ]]
< then
< echo "Error reading temperature by command
'$command':
< $tval"
< restorefans 1
< fi
< else
< read tval < ${tsens}
< if [ $? -ne 0 ]
< then
< echo "Error reading temperature from
$DIR/$tsens"
< restorefans 1
< fi
< if [ "$SYSFS" = "1" ]
< then
302,304c286,287
< else
< tval=`echo ${tval} | cut -d' ' -f3 | cut
-d'.' -f1`
< fi
---
Quoted 2 lines
else
tval=`echo ${tval} | cut -d' ' -f3 | cut -d'.' -f1`=== diff showing changes to fancontrol 0.67 begins ===
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors