Re: capturing system shutdown signals?

Alexander Schreiber <[email protected]>
Newsgroups gmane.lisp.steel-bank.general
Message-ID <[email protected]>
On Sat, Apr 27, 2024 at 12:32:57PM -0400, Jeff Cunningham wrote:
> Yes, there is a daemon running that listens to the UPS. I've got some
> test code in place now to try to determine what signal the kernel is
> generating when the UPS tells the hardware it's shutting
> down. Expensive, troublesome test though. I'm pretty sure it's a
> SIGTERM (at least initially).

Some systems (IIRC AIX on POWER, but then AIX is hardly Unix) have
SIGPOWER for when the power is about to fail, but neither
Linux nor BSD have that.

AFAIK, the UPS daemon, if configured to do so, simply initiated
a regular system shutdown (shutdown -h now) when the battery is
about to run out. You might be able to hook a command into the
UPS daemon config to "tickle" your process into clean shutdown.

Kind regards,
           Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.