UPS directed system shutdown info needed

Keith Gabryelski ag at elgar.UUCP
Sat Feb 4 15:25:30 AEST 1989


In article <10170 at drutx.ATT.COM> blum at drutx.ATT.COM (Mark Blumhardt) writes:
>In article <431 at ispi.UUCP>, jbayer at ispi.UUCP (Jonathan Bayer) writes:
>> In article <210 at wa3wbu.UUCP> john at wa3wbu.UUCP (John Gayman) writes:
>> >
>> >    Does anyone have experience with interfacing a small UPS system (600-
>> >1000VA) to a 386-based Unix box to allow for orderly system shutdown
>> >when the batteries run down ?
>> >
>> What you want to do is to create a background daemon which will poll a
>> serial port.  The serial port will be hooked up to the ups...
>
>Another way, which may use less resources is to...hook the serial port to
>the UPS, and connect (I cant remember exactly) ground and DTR.  Exec a
>process that tries to open the port.  It will block (or return), depending
>on the state of the contact closure.  After the return you can do a
>graceful shutdown.

Yes, as I had pointed out earlier, this is infact how Elgar's UniSafe
product works.  I think Jonathan was talking about a fault tolerant
way of handling the communications on a possibly faulty serial device
(one which may hang).

Actually, the first demo I gave of UniSafe was basicly:

    cat /dev/null >/dev/ttya	# When this returns, we are on battery power

    wall << THEEND
    We're on battery power.  Going down in 1 minute.
    THEEND

    sleep 60			# One minute

    /etc/shutdown 0		# See Ya!

This is ofcourse simplistic; you'd never want to wait just one minute
and you'd definitely want to test for short term power failures, but
it does the job.

Pax, Keith
-- 
ag at elgar.CTS.COM         Keith Gabryelski          ...!{ucsd, crash}!elgar!ag



More information about the Comp.unix.questions mailing list