Previous Next Contents

3. How it's supposed to work

UPS's job

When the power goes out, the UPS continues to power the PC and signals that the power went out by throwing a relay or turning on an opticoupler on it's control port.

Cable's job

The cable is designed so that when the UPS throws said relay, this causes a particular serial port control line (typically DCD) to go high.

Powerd's job

Powerd monitors the serial port. Keeps raised/lowered whatever serial port control lines the UPS needs to have raised/lowered (typically, DTR must be kept high and whatever line shuts off the UPS must be kept low). When powerd sees the UPS control line go high, it writes FAIL to /etc/powerfail and sends the initd process a SIGPWR signal. When the control line goes low again, it writes OK to /etc/powerfail and sends initd a SIGPWR signal.

Initd's job (aside from everything else it does)

When it receives a SIGPWR, it looks at /etc/powerfail. If it contains FAIL it runs the powerfail entry from /etc/inittab. If it contains OK it runs the powerokwait entry from inittab.


Previous Next Contents