SIGPWR signal in system v
Robert White
rwhite at nusdecs.uucp
Tue May 7 04:44:30 AEST 1991
RE: SIGPWR questions....
On the systems I use (386 and 3B2) you need special hardware attached
to a UPS (uninteruptable power supply) in order for your system to
support SIGPWR. You are exactly correct that there isnt any time
for anything to happen in software durring a normal power failure.
If you dont have a built-in UPS, or an external UPS and a builtin
board, SIGPWR is never generated, the system simply dies. You
know power-in=power-out, power-in=0 => activity=0 (etc.)
The typical mechanisim (as implemented on a 3B2) goes like this.
The UPS powers the system and has "external alarm closures" which
are relays that close switches across known pins on a connector
on the side of the UPS. A remote managment board has two conductor
pairs that represent "loss of AC feed" and "low battery". Continuity
across the pair indicates the condition is present. When a poweroutage
takes place closure occurs across the LOACF pair. A sanity daemon
(or other sortware hack usually running as a normal process) discovers
the condition within a known period (granularity usually about
one minute modified by your cron(1) period), a notification message
"Warning: System Power Fault" or some such is generated and
the program goes to sleep for a set interval. The interval
being arbatrary and chosen based on aprox 3/4 of the available
batery time. When the time is expired the program checks the
hardware to see if the power outage condition is still present
(clear the hardwar flag and see if the hardware resets it).
If there is still no AC, the program initates a "normal"
shutdown.
If the "low batery" condition becomes true while the LOACF is true
the software will *only then* issue SIGPWR (eh, this is supposed to
be a "standard", sometimes SIGPWR will be the "normal shutdown"
method mentioned above in the case of really clever/obscure system
drivers) ti indicate that the AC is off and there is no way to predict
how long the UPS can keep the system up, so it is going down *NOW*
*ASAP* with only minimum prepration. In a tightly implemented
environment the time between SIGPWR and a totally synced and
quesent system should be aobut 15 seconds. (e.g. SIGPWR, 3 sec,
SIGTERM, 5 sec, SIGKILL, 2 sec, sync(s) and umounts(s), halt or
some such. The SIGTERM is recommended if you have lots of programs
that will not catch SIGPWR, that will catch SIGTERM and which
you *really* want to do their emergency shutdown routines [e.g.
database apps] otherwise, just skip it and bail asap.)
In the 386 environment the UPS(s) that support the Netware Feature
Connectors are the ones that support this kind of environment.
I don't know wether the netware feature boards are supported in
any/many/most/all UNIX implementations but if they are not it
should be a trival driver to implement (wrt power sensing)
if the technical manual is available. Also, a software driver
was posted here a week or so ago that lets a serial port use
CD to indicate a power falure when the associated device is
plugged into raw AC and the computer is pluuged into a UPS.
More information about the Comp.unix.wizards
mailing list