bpowerd v1.0
Author: Christopher Craig <ccraig@cc.gatech.edu>

Copyright: This program is released under the GNU Public License

bpowerd is a program to monitor Best Power Patriot and Patriot Plus UPSs under
Linux.  It uses to Sys V init method of informing the system of a power outage
and is capable of detecting power fail and low battery conditions.  It is also
capable of killing the inverter on shutdown.

The following is the steps taken in the event of a powerfail

1) bpowerd detects failure and writes FAIL to /etc/powerstatus and either
FAIL or SCRAM to /var/run/upsstatus for a power failure or low battery 
condition respectively. 
2) bpowerd signals init with SIGPWR
3) init executes the command in the line starting with "pf", this should be 
a call to bpowerfail with the "start" argument
4) bpowerfail executes the command associated with the state in 
/var/run/upsstatus

If the power comes back on "OK" is written to both /var/run/upsstatus and
/etc/powerstatus and init is signaled.  init then runs the command on the line
starting with "pg" which should be a call to bpowerfail with the "stop"
option.  bpowerfail then halts all running shutdowns.

This is a schem for the cable that Best provides for the UPS, so if you want
to make your own here you go:

All:  \/\/\/ = Resistor (3.3K)
        UPS pin 1 Shutdown
        UPS pin 3 Inverter
        UPS pin 4 common
        UPS pin 5 Low Runtime

DB-9 (UPS)                                    DB-9 (Computer)  DB-25 (Computer)
1 ------------------------------------------------- 4 ---------- 20
                               +--\/\/\/----------- 2 ---------- 3
                               |
3 -----------------------------+--\/\/\/----------- 3 ---------- 2

4 ------------------------------------------------- 5 ---------- 7
5 -----------------------------+--\/\/\/---+------- 1 ---------- 8
                               |           |
                               |           +------- 6 ---------- 6
                               +--\/\/\/----------- 7 ---------- 4


Thanks to 
Best Power for their cooperation in giving me the schematics for thier control
line so that I didn't have to wait for it to get here.

Tom Webster, for writing genpowerd which I pulled heavily from 

and 

Jesus Christ for allowing me to live.
