Joe Emenaker wrote:
> I haven't tried bpowerd. How configurable is it? Right now, I'm using a
> tricked-up version of the backupsd or apdc or whatever it was called. It
> communicates with init via the status files in /etc... which I don't mind
> all that much. However, one thing that I altered it to do is, when it sees
> the UPS reporting a powerfail, it waits until it gets 10 full seconds of
> powerfail indication before it takes any action toward scheduling a
> shutdown. So a brownout or momentary power glitch won't trigger the
> shutdown. Also, if the power comes back on before the shutdown, it waits
> until it sees 10 full seconds of poweron indication before canceling the
> shutdown.
> 
> Can bpowerd do that?

bpowerd works by polling and keeping an internal state.  This is set
at comile time, so is not configurable thru command-line options.
Howevr, the source is clean and could be easily changed and recompiled.
See http://www.ccraig.org/bpowerd/

But, since it calls a (user changeable) script /etc/init.d/powerfail
you can make it do almost anything.  Here is the basic operation:

bpowerd polls the power supply every 30 seconds, Looking for one of
three states: powerok, powerfail, and batterylow.  These are the only
three states that can be communicated by the power supply.  Bpowerd
will do nothing as long as it keeps getting a powerok response at each
poll.  However, if it recieves a powerfail response, it will run the
script '/etc/init.d/powerfail start'.  It then looks for changes from
this state.  If it gets a powerok on a subsequent poll, it will run
'/etc/init.d/powerfail stop'.  If it recieves a batterylow response
at any poll, it will run '/etc/init.d/powerfail now'.  It runs all these
scripts by communicating with the init daemon as defined in /etc/inittab.

The default behavior for the scripts is:
powerfail start - Broadcasts a warning to all users and will shutdown if
no other signal is recieved in 15 minutes.

powerfail stop - Called when power is restored after a failure.  Will cancel
the shutdown and broadcast to all users that power is restored.

powerfail now - Occurs on a battery low condition.  Shuts down immediately.

Of course you can change these scripts to do anything you want.  If you
want to tweak the polling timing, you must recompile from source.
However, I think the default scripts/values are reasonable and will suit
most user's needs.  I've had momentary power failures or brownouts that
weren't even noticed because they fell within polling periods.  I've also
had some that were detected, but the effects were cancelled on the next
poll when bpowerd detected that the power was restored.

-Mitch

Attachment: pgpvU6NIX5xZ3.pgp
Description: PGP signature

Reply via email to