🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.misc
Article #383

Re: Auto shutdown (on power down) box

#383
From: Chris Gonnerman
Date: Wed, 12 Sep 1990 17:03
42 lines
2392 bytes
In article <562@DIALix.UUCP>, bernie@DIALix.oz.au (Bernd Felsche) writes:
> In article <1990Sep7.174211@curly.Viewlogic.COM> alan@curly.Viewlogic.COM (Alan Medsker) writes:
> >I've got an Epoch-1 Infinitestorage NFS server, and a UPS that it runs
> >off of.  I'd like to find a way to have the server shut down
> >gracefully unattended when the power has been down for x minutes.
> >Any ideas?
> >
> Yup: Use the computer.
> 
> If the UPS has a normally closed (mains available contact) then all
> you need to do is to hook up a serial cable to spare port on your
> computer.  You can check the mains directly, by getting a relay
> which has a mains-rated coil, and connecting that to a power point.
> I think that you can find a cheap plug-pack-type enclosure to stuff
> this into, making a tidy installation.
> 
> bernie


We did the same thing with a "network-compatible" UPS that turned out to
have only a normally-open contact, which closes (connects) on power
outage.  My code was simpler, though: it opens the port and runs
shutdown.

My cables run the UPS connections to the DCD and DTR lines.  When open()
is attempted on a port, DTR is asserted and DCD is waited for.  When
open() returns, therefore, DCD has been detected.

When the power fails, the computer's DTR line is connected to it's DCD
line, and open() is allowed to return.

So, the program sleeps constantly until power fails, then the kernel
wakes it and the system is brought down gracefully.

Simple, huh?  Most systems with healthy serial drivers and hardware can
do the same thing.

-- 
 +----------------------------------------------------------------------------+
 | Chris Gonnerman (Mad Programmer At Large)   csusac.ecs.csus.edu!tree!jcg   |
 | @ the Tree BBS, Sacramento, CA              ucbvax!ucdavis!csusac!tree!jcg |
 +----------  DISCLAIMER: These opinions are mine... MINE, I say!  -----------+
Technical Details
Message-ID: <1990Sep12.170337.14660@tree.uucp>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!sdd.hp.com!usc!samsung!umich!sharkey!indetech!pacbell!sactoh0!tree!
References: <1990Sep7.174211@curly.Viewlogic.COM> <562@DIALix.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!sdd.hp.com!usc!samsung!umich!sharkey!indetech!pacbell!sactoh0!tree!
From: @tree.uucp (Chris Gonnerman)
Newsgroups: comp.sys.misc
Subject: Re: Auto shutdown (on power down) box
Keywords: UPS power shutdown unix epoch
Message-ID: <1990Sep12.170337.14660@tree.uucp>
Date: 12 Sep 90 17:03:37 GMT
References: <1990Sep7.174211@curly.Viewlogic.COM> <562@DIALix.UUCP>
Organization: TREE BBS (916)349-0385 Sacramento, Ca
Lines: 42