Log power button

Arthur Chance freebsd at qeng-ho.org
Thu Jan 28 08:24:45 UTC 2016


On 27/01/2016 18:55, Andrea Venturoli wrote:
> Hello.
>
> A server of mine (10.1) is "spontaneusly" rebooting.
> This is not a power failure/panic/crash/whatever, since it properly
> shuts down.
>
> I suspect someone is pushing the power button, but I have no physical
> way to check. Problem is, this is not reported in the logs.
>
> I vaguely remember older FreeBSD versions did this once, but I might be
> wrong; I cannot check on this box (100km away), but I tried on another
> one and, to my surprise, the fact that I pressed the power button was
> NOT logged.
>
> Is there any way to enable this?
> Maybe I'm dumb, but I looked for this and found nothing.

It's not an area I'm that familiar with so double check this, but take a 
look towards the end of /etc/devd.conf, where there's a comment about 
ACPI notify handlers. There's a "Button" subsystem related to power and 
sleep buttons. You probably want a devd rule that looks something like

notify 0 {
	match "system"		"ACPI";
	match "subsystem"	"Button";
	match "notify"		"0";
	action	"logger -p daemon.alert Power button pressed";
}

I can't guarantee that will work, I've never tried it, but it's a place 
to start.

-- 
Moore's Law of Mad Science: Every eighteen months, the minimum IQ
necessary to destroy the world drops by one point.


More information about the freebsd-questions mailing list