Re: debian & UPS support
Jozef Hitzinger wrote:
> > > I'm curious because the standard rc0.d/S90halt script refers to ups:
> > >
> > > #! /bin/sh
> > > # halt Execute the halt command.
> > > # Version: @(#)halt 2.75 19-May-1998 email@example.com
> > > PATH=/sbin:/bin:/usr/sbin:/usr/bin
> > > # See if we need to cut the power.
> > > if [ -x /etc/init.d/ups-monitor ]
> > > then
> > > /etc/init.d/ups-monitor poweroff
> > > fi
> > > halt -d -f -i -p
> > Here's what I figured out (please correct me if I'm wrong).
> > - Have your package provide and conflict with "ups-monitor"
> and with other ups packages too, I presume
No. They should also provide and conflict with "ups-monitor" and
so this is taken care of without aprori knowing the full list of
UPS packages (which seems to be growing weekly!).
> > - provide a symlink such that /etc/init.d/ups-monitor points to
> > your /etc/init.d/smartupstools script. This script should
> > accept the "poweroff" argument to send the kill signal to the
> > UPS on system halt.
> means that 'ups-monitor' is just hardcoded into halt script?
> ok, I can
> mimic it's behavior, but .. hmm, I didn't find anything about this in the
> policy. please give me a pointer if it's just my blindness
Not mentionned in Policy. Some of this is documented in the
sysvinit package (in particular the /etc/init.d/powerfail
script). Since halt is part of that package, the docs might be
in there somewhere too.
> > Unrelated, but extra info: My package also has a
> > /etc/init.d/powerfail script. This script is the one called by
> > init (as configured by /etc/inittab) and should accept the
> > arguments "start", "stop" and "now":
> > - `/etc/init.d/powerfail start' initiates a timed "shutdown -h"
> > (halt) in background, on the assumption that if power is
> > restored the shutdown can be cancelled.
> > - `/etc/init.d/powerfail stop' cancels the running shutdown and
> > notifies all users that power is restored and no shutdown is
> > imminent.
> > - `/etc/init.d/powerfail now' cancels the running shutdown and
> > initiates an immediate "shutdown -h" in foreground; this means
> > once the UPS tells you the battery is low, you will indeed
> > shutdown (there is no recovery).
> > Note that as you halt the machine, the shutdown sequence
> > (/etc/init.d/halt) invokes ups-monitor one last time with the
> > kill flag (-k), forcing the UPS to turn off, but only if the UPS
> > is indeed in either the FAIL or LOW state (in any case, any UPS I
> > know of will ignore the kill signal if power is still available).
> I probably won't need something like this .. If the line is good,
> there's no reason to shutdown the ups, if the power failed, shutdown will
> be triggered when battery gets low.
The point is to save the UPS battery by telling _it_ to shutdown
after we have bought the computer down.