On 6 March 2010 08:26, Tomas Bodzar <tomas.bod...@gmail.com> wrote: > Hi all, > > I set sensorsd and sensorsd.conf this way : > > # $OpenBSD: sensorsd.conf,v 1.8 2007/08/14 19:02:02 cnst Exp $ > > # > # Sample sensorsd.conf file. See sensorsd.conf(5) for details. > # > > # +5 voltage (volts) > #hw.sensors.lm0.volt3:low=4.8V:high=5.2V > > # +12 voltage (volts) > #hw.sensors.lm0.volt4:low=11.5V:high=12.5V > > # Monitor laptop battery for remaining capacity > hw.sensors.acpibat0.watthour3:low=1.40Wh:command=/etc/sensorsd/switchoff > > # Chipset temperature (degrees Celsius) > #hw.sensors.lm0.temp0:high=50C > hw.sensors.acpitz0.temp0:high=60C:command=/etc/sensorsd/switchoff > hw.sensors.acpitz1.temp0:high=60C:command=/etc/sensorsd/switchoff > > # CPU temperature (degrees Celsius) > #hw.sensors.lm0.temp1:high=60C > hw.sensors.cpu0.temp0:high=65C:command=/etc/sensorsd/switchoff > > # CPU fan (RPM) > #hw.sensors.lm0.fan1:low=3000 > hw.sensors.acpithinkpad0.fan0:low=2500:command=/etc/sensorsd/switchoff > > # ignore certain indicators on ipmi(4) > #hw.sensors.ipmi0.indicator1:istatus > > # Warn if any temperature sensor is over 70 degC. > # This entry will match only those temperature sensors > # that don't have their own entry. > #temp:high=70C > > > # By default, sensorsd(8) reports status changes of all sensors that > # keep their state. Uncomment the following lines if you want to > # suppress reports about status changes of specific sensor types. > > #temp:istatus > #fan:istatus > #volt:istatus > #acvolt:istatus > #resistance:istatus > #power:istatus > #current:istatus > #watthour:istatus > #amphour:istatus > #indicator:istatus > #raw:istatus > #percentage:istatus > #illuminance:istatus > #drive:istatus > #timedelta:istatus > > Command is simple : > > #!/bin/sh > shutdown -h now "Shutdown caused by sensor" > > It's running from point of view that computer is turned off in case of > low battery or high battery on some of sensor which has command > assigned. Problem starts if your battery is empy and computer turned > off. So you plug AC and start laptop. If you are below limit for > hw.sensors.acpibat0.watthour3 then your laptop is turned off after > login again. It's quite understandable, but if you're above limit > behavior is still same. Is it problem this part from man page for > sensorsd.conf? > > If the limits are crossed or if the status provided by the driver > changes, sensorsd(8)'s alert functionality is triggered and a command, if > specified, is executed. > > Battery status trough this sensor is changing because battery was > empty and now laptop is in AC and charging. Does it really mean that > it will turn off my computer after every change of battery status > untill my battery is fully recharged?
core:constant {6432} man sensorsd.conf | fgrep -C5 shutdown CAVEATS Alert functionality is triggered every time there is a change in sensor state; for example, when sensorsd(8) is started, the status of each moni- tored sensor changes from undefined to whatever it is. One must keep this in mind when using commands that may unconditionally perform adverse actions (e.g. shutdown(8)), as they will be executed even when all sen- sors perform to specification. If this is undesirable, then a wrapper shell script should be used instead. OpenBSD 4.6 March 15, 2008 2 core:constant {6433} Try using the %l token in your scripts for conditional shutdown. C.