Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2016 08:24:35 +0000
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        Andrea Venturoli <ml@netfence.it>, freebsd-questions@freebsd.org
Subject:   Re: Log power button
Message-ID:  <56A9D043.60508@qeng-ho.org>
In-Reply-To: <56A9129A.5050707@netfence.it>
References:  <56A9129A.5050707@netfence.it>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56A9D043.60508>