fancontrol modification to get temp by running a configurable command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
---
> # Version 0.67
281c277,283
< 		if [[ ${tsens#command:} != $tsens ]]
---
> 		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
---
> 		else
> 			tval=`echo ${tval} | cut -d' ' -f3 | cut -d'.' -f1`
=== diff showing changes to fancontrol 0.67 begins ===



-------------- next part --------------
A non-text attachment was scrubbed...
Name: fancontrol
Type: application/octet-stream
Size: 10815 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20090122/6cd37c4a/attachment.obj 


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux