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? OpenBSD 4.7-beta (GENERIC.MP) #423: Tue Feb 23 12:24:22 MST 2010 dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP cpu0: Intel(R) Core(TM)2 Duo CPU L7300 @ 1.40GHz ("GenuineIntel" 686-class) 1.40 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR real mem = 2657374208 (2534MB) avail mem = 2574045184 (2454MB) mainbus0 at root bios0 at mainbus0: AT/286+ BIOS, date 07/02/07, BIOS32 rev. 0 @ 0xfdc80, SMBIOS rev. 2.4 @ 0xe0010 (63 entries) bios0: vendor LENOVO version "7NET25WW (1.06 )" date 07/02/2007 bios0: LENOVO 766927G acpi0 at bios0: rev 2 acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG HPET SLIC BOOT ASF! SSDT SSDT SSDT SSDT acpi0: wakeup devices LID_(S3) SLPB(S3) DURT(S3) IGBE(S4) EXP0(S4) EXP1(S4) EXP2(S4) EXP3(S4) EXP4(S4) PCI1(S4) USB0(S3) USB1(S3) USB2(S3) USB3(S3) USB4(S3) EHC0(S3) EHC1(S3) HDEF(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: apic clock running at 199MHz cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Core(TM)2 Duo CPU L7300 @ 1.40GHz ("GenuineIntel" 686-class) 1.40 GHz cpu1: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins ioapic0: misconfigured as apic 2, remapped to apid 1 acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (AGP_) acpiprt2 at acpi0: bus 2 (EXP0) acpiprt3 at acpi0: bus 3 (EXP1) acpiprt4 at acpi0: bus -1 (EXP2) acpiprt5 at acpi0: bus -1 (EXP3) acpiprt6 at acpi0: bus -1 (EXP4) acpiprt7 at acpi0: bus 5 (PCI1) acpiec0 at acpi0 acpicpu0 at acpi0: C3, C2, C1, PSS acpicpu1 at acpi0: C3, C2, C1, PSS acpipwrres0 at acpi0: PUBS acpitz0 at acpi0: critical temperature 127 degC acpitz1 at acpi0: critical temperature 99 degC acpibtn0 at acpi0: LID_ acpibtn1 at acpi0: SLPB acpibat0 at acpi0: BAT0 model "42T5247" serial 505 type LION oem "SANYO" acpibat1 at acpi0: BAT1 not present acpibat2 at acpi0: BAT2 not present acpiac0 at acpi0: AC unit online acpithinkpad0 at acpi0 acpidock0 at acpi0: GDCK not docked (0) bios0: ROM list: 0xc0000/0x10000! 0xd0000/0x1000 0xd1000/0x1000 0xe0000/0x10000! cpu0: Enhanced SpeedStep 1397 MHz: speeds: 1401, 1400, 1200, 800 MHz pci0 at mainbus0 bus 0: configuration mode 1 (bios) pchb0 at pci0 dev 0 function 0 "Intel GM965 Host" rev 0x0c vga1 at pci0 dev 2 function 0 "Intel GM965 Video" rev 0x0c wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) intagp0 at vga1 agp0 at intagp0: aperture at 0xe0000000, size 0x10000000 inteldrm0 at vga1: apic 1 int 16 (irq 10) drm0 at inteldrm0 "Intel GM965 Video" rev 0x0c at pci0 dev 2 function 1 not configured vendor "Intel", unknown product 0x2a04 (class communications subclass miscellaneous, rev 0x0c) at pci0 dev 3 function 0 not configured pciide0 at pci0 dev 3 function 2 "Intel GM965 PT IDER" rev 0x0c: DMA (unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI pciide0: using apic 1 int 18 (irq 11) for native-PCI interrupt pciide0: channel 0 ignored (not responding; disabled or no drives?) pciide0: channel 1 ignored (not responding; disabled or no drives?) "Intel GM965 KT" rev 0x0c at pci0 dev 3 function 3 not configured em0 at pci0 dev 25 function 0 "Intel ICH8 IGP M AMT" rev 0x03: apic 1 int 20 (irq 11), address MAC uhci0 at pci0 dev 26 function 0 "Intel 82801H USB" rev 0x03: apic 1 int 20 (irq 11) uhci1 at pci0 dev 26 function 1 "Intel 82801H USB" rev 0x03: apic 1 int 21 (irq 11) ehci0 at pci0 dev 26 function 7 "Intel 82801H USB" rev 0x03: apic 1 int 22 (irq 11) usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 azalia0 at pci0 dev 27 function 0 "Intel 82801H HD Audio" rev 0x03: apic 1 int 17 (irq 11) azalia0: codecs: Analog Devices AD1984, Conexant/0x2bfa, using Analog Devices AD1984 audio0 at azalia0 ppb0 at pci0 dev 28 function 0 "Intel 82801H PCIE" rev 0x03: apic 1 int 20 (irq 11) pci1 at ppb0 bus 2 ppb1 at pci0 dev 28 function 1 "Intel 82801H PCIE" rev 0x03: apic 1 int 21 (irq 11) pci2 at ppb1 bus 3 wpi0 at pci2 dev 0 function 0 "Intel PRO/Wireless 3945ABG" rev 0x02: apic 1 int 17 (irq 11), MoW2, address MAC uhci2 at pci0 dev 29 function 0 "Intel 82801H USB" rev 0x03: apic 1 int 16 (irq 10) uhci3 at pci0 dev 29 function 1 "Intel 82801H USB" rev 0x03: apic 1 int 17 (irq 11) ehci1 at pci0 dev 29 function 7 "Intel 82801H USB" rev 0x03: apic 1 int 19 (irq 11) usb1 at ehci1: USB revision 2.0 uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1 ppb2 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xf3 pci3 at ppb2 bus 5 cbb0 at pci3 dev 0 function 0 "Ricoh 5C476 CardBus" rev 0xba: apic 1 int 16 (irq 10) "Ricoh 5C832 Firewire" rev 0x04 at pci3 dev 0 function 1 not configured sdhc0 at pci3 dev 0 function 2 "Ricoh 5C822 SD/MMC" rev 0x21: apic 1 int 18 (irq 11) sdmmc0 at sdhc0 cardslot0 at cbb0 slot 0 flags 0 cardbus0 at cardslot0: bus 6 device 0 cacheline 0x0, lattimer 0xb0 pcmcia0 at cardslot0 pcib0 at pci0 dev 31 function 0 "Intel 82801HEM LPC" rev 0x03 pciide1 at pci0 dev 31 function 1 "Intel 82801HBM IDE" rev 0x03: DMA, channel 0 configured to compatibility, channel 1 configured to compatibility pciide1: channel 0 disabled (no drives) pciide1: channel 1 ignored (disabled) ahci0 at pci0 dev 31 function 2 "Intel 82801HBM AHCI" rev 0x03: apic 1 int 16 (irq 10), AHCI 1.1 scsibus0 at ahci0: 32 targets sd0 at scsibus0 targ 0 lun 0: <ATA, ST9120822AS, 3.CL> SCSI3 0/direct fixed sd0: 114473MB, 512 bytes/sec, 234441648 sec total ichiic0 at pci0 dev 31 function 3 "Intel 82801H SMBus" rev 0x03: apic 1 int 23 (irq 11) iic0 at ichiic0 usb2 at uhci0: USB revision 1.0 uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb3 at uhci1: USB revision 1.0 uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb4 at uhci2: USB revision 1.0 uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb5 at uhci3: USB revision 1.0 uhub5 at usb5 "Intel UHCI root hub" rev 1.00/1.00 addr 1 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 pms0 at pckbc0 (aux slot) pckbc0: using irq 12 for aux slot wsmouse0 at pms0 mux 0 pcppi0 at isa0 port 0x61 midi0 at pcppi0: <PC speaker> spkr0 at pcppi0 aps0 at isa0 port 0x1600/31 npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16 mtrr: Pentium Pro MTRR support uhidev0 at uhub3 port 1 configuration 1 interface 0 "IBM USB Optical Mouse" rev 2.00/2.00 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons, Z dir wsmouse1 at ums0 mux 0 ubt0 at uhub2 port 1 "Broadcom Corp BCM2045B" rev 2.00/1.00 addr 2 ugen0 at uhub2 port 2 "STMicroelectronics Biometric Coprocessor" rev 1.00/0.01 addr 3 vscsi0 at root scsibus1 at vscsi0: 256 targets softraid0 at root root on sd0a swap on sd0b dump on sd0b -- http://www.openbsd.org/lyrics.html