UPS directed system shutdown info needed

Keith Gabryelski ag at elgar.UUCP
Fri Jan 20 04:59:09 AEST 1989


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 ?

I do, that is ... I wrote such an interface to SCO Xenix, SunOS, SysV,
and BSD machines for Elgar Corporation.

>I see most small UPS vendors are offering a signal port option on
>most of their units. I also see vendors offering software drivers for
>the popular Mess-DOS LAN systems.

MS-DOS, OS2, Novell, 3Com, Unix, Xenix ... It is a big market.

>My question is, how are these interfaces being handled by small Unix
>boxes?

Our interface is through a cable to a serial port.  This seemed the
most logical, since they are readily available [read no development
time needed to design a card for each bus out there] and can be added
for relative cheapness.

>I'm using a 386 machine running Microport V/386.  What would it take
>to have the system shutdown (logically) from a signal on an UPS?  I
>assume most UPS's interfaces simply bring a signal low (or high) and
>its up to the system to act upon it ?  Or does the UPS carry on a
>dialog with the CPU ? (ie: Pssst, I have 3 minutes left, watta ya
>wanna do, shutdown or go for broke ? Well punk, do ya feel lucky ?)

(two senarios)

First for the Z-1000, Zenith Data System's new multi-386 system,
running a hacked up SCO XENIX.

    This uses an internal (on-line) IPS (Intelligent Power System).
    The IPS signals init to run a shutdown program which sends a
    message to the users; something like "System on Battery Power,
    Save and Logout".  Then, the process sleeps for a couple of
    minutes and calls uadmin() with a new flag that flushes cache and
    inverts power in the IPS (saving battery time for subsequent power
    failures).

    When commercial power is restored, the system boots and users are
    allowed to login.

[This scenario does not require a serial port, because the IPS was
specifically designed for Z-1000 and is actually internal to the
system.]

The second scenario is for any system that does not use an internal
IPS.

    A daemon monitors a serial port for a message from the IPS tell it
    that the system is on battery power.  Actually, the daemon blocks
    on an open() to the serial port.  When the system goes on battery
    power, the IPS asserts a HIGH on the DCD pin which allows the
    open() to return.  This tells the daemon the the system is on
    battery power.

    The daemon sends out warning messages (every minute or so) to the
    users until a countdown time has elasped.  If commercial power is
    restored before the countdown, the daemons sends out a power
    restored message to the users and resets itself.

    At the end of the countdown time (if commercial power hasn't been
    restored) the daemon executes a shutdown script which logs out the
    users, unmounts the files systems, syncs the unmountable file
    systems and inverts power in the IPS.  This shuts power off to the
    system (to save battery time) until commercial power is restored.

    When commercial power is restored, the system boots and users are
    allowed to login.

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



More information about the Comp.unix.questions mailing list