Re: debian & UPS support
Jozef Hitzinger wrote:
> Can somebody point me to info on how debian cooperates with UPS? (rtfm is
> ok) I'd also welcome response from the person who takes care of debian
> <-> ups functionality (if there is one).
I'd like to know, if such a person exists.
> When the battery power gets low, system has to go down, and just before
> halt a power-off command to the ups should be issued. That means modifying
> rc scripts, so I wonder if there is some universal policy, or every ups
> package just does it on its own.
>
> 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 miquels@cistron.nl
> 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
I'm finishing up packaging powstatd (a configurable dumb-mode UPS
monitor that works out of the box with Cyber Power Systems
UPSes).
Here's what I figured out (please correct me if I'm wrong).
- Have your package provide and conflict with "ups-monitor"
- 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.
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).
--
Peter Galbraith, research scientist <GalbraithP@dfo-mpo.gc.ca>
Maurice Lamontagne Institute, Department of Fisheries and Oceans Canada
P.O. Box 1000, Mont-Joli Qc, G5H 3Z4 Canada. 418-775-0852 FAX: 775-0546
6623'rd GNU/Linux user at the Counter - http://counter.li.org/
Reply to: