[comp.unix.sysv386] Cheap or free auto-shutdown setup

mark@intek01.uucp (Mark McWiggins) (09/30/90)

rdc30med@nmrdc1.nmrdc.nnmc.navy.mil (LCDR Michael E. Dobson) writes:
[about a $250 autoshutdown monitor]

Don't know why I didn't think of this sooner, but wouldn't a 300 bps
external modem work just as well?  Send 'AT' every 30 seconds or so and wait 
for 'OK' ... You should be able to get one of these modems really cheap at a 
swap meet, or perhaps lying around for free.  If all else fails, new 300/1200
externals go for $75 or less via Computer Shopper.

This scheme would of course also work with any other doodad (program running
on a nearby PC?) that has a separate non-protected power supply and knows how
to respond to commands via a serial port.  Can't think of anything that would
be as cheap as an old modem, but am open to suggestion on that.

The shell script to listen on the port and do the shutdown seems trivial;
I'll post a copy of mine when I get it done, unless somebody beats me to it.
-- 
Mark McWiggins			Integration Technologies, Inc. (Intek)
+1 206 455 9935			DISCLAIMER:  I could be wrong ...
1400 112th Ave SE #202		Bellevue WA  98004
mark@intek.com    		Ask me about C++!

bill@bilver.UUCP (Bill Vermillion) (09/30/90)

In article <1990Sep29.220137.6550@intek01.uucp-> mark@intek01.uucp (Mark McWiggins) writes:
->rdc30med@nmrdc1.nmrdc.nnmc.navy.mil (LCDR Michael E. Dobson) writes:
->[about a $250 autoshutdown monitor]
->
->Don't know why I didn't think of this sooner, but wouldn't a 300 bps
->external modem work just as well?  Send 'AT' every 30 seconds or so and wait 
->for 'OK' ... You should be able to get one of these modems really cheap at a 
->swap meet, or perhaps lying around for free.  If all else fails, new 300/1200
->externals go for $75 or less via Computer Shopper.
->
->This scheme would of course also work with any other doodad (program running
->on a nearby PC?) that has a separate non-protected power supply and knows how
->to respond to commands via a serial port.  Can't think of anything that would
->be as cheap as an old modem, but am open to suggestion on that.
->
->The shell script to listen on the port and do the shutdown seems trivial;
->I'll post a copy of mine when I get it done, unless somebody beats me to it.

Why couldn't you just use a cheap relay connected to the mains power
source.  Then connect pins 2 & 3 of the rs232 to a pair of contacts that
are closed when power is on.  Then just send something out and see if it
echos.  If it doens't come back to you, the power is off!

Or am I really overlooking something here?:
-- 
Bill Vermillion - UUCP: uunet!tarpit!bilver!bill
                      : bill@bilver.UUCP

tim@delluk.uucp (Tim Wright) (10/01/90)

In <1030@bilver.UUCP> bill@bilver.UUCP (Bill Vermillion) writes:

>Why couldn't you just use a cheap relay connected to the mains power
>source.  Then connect pins 2 & 3 of the rs232 to a pair of contacts that
>are closed when power is on.  Then just send something out and see if it
>echos.  If it doens't come back to you, the power is off!

Seems fine but why bother to go even this far. All the methods mentioned
so far imply polling. If you setup a relay etc. to pull up DCD on power loss,
and have a process try to open a modem-control enabled port, then all is
simple. The power dies, the relay trips, DCD goes high, open succeeds, the
process wakes up and shuts down the system.
Voila !

Tim
--
Tim Wright, Dell Computer Corp. (UK) | Email address
Dell Computer Corp. (UK), Bracknell  | Domain: tim@dell.co.uk
Tel: +44-344-860456                  | Uucp: ...!ukc!delluk!tim
"What's the problem? You've got an IQ of six thousand, haven't you?"

mvadh@cbnews.att.com (andrew.d.hay) (10/01/90)

In article <1030@bilver.UUCP>, bill@bilver.UUCP (Bill Vermillion) writes:
[]
> Why couldn't you just use a cheap relay connected to the mains power
> source.  Then connect pins 2 & 3 of the rs232 to a pair of contacts that
> are closed when power is on.  Then just send something out and see if it
> echos.  If it doens't come back to you, the power is off!
> 
> Or am I really overlooking something here?:

that's what we do here -- in fact, our upses have such relay contacts
built in...

-- 
Andrew Hay		+------------------------------------------------------+
Ragged Individualist	| 	You just have _N_O idea!  It's the difference    |
AT&T-BL Ward Hill MA	|	between _S_H_O_O_T_I_N_G a bullet and _T_H_R_O_W_I_N_G it!     |
a.d.hay@att.com		+------------------------------------------------------+

julian@bongo.UUCP (Julian Macassey) (10/01/90)

In article <1030@bilver.UUCP>, bill@bilver.UUCP (Bill Vermillion) writes:
> In article <1990Sep29.220137.6550@intek01.uucp-> mark@intek01.uucp (Mark McWiggins) writes:
> ->rdc30med@nmrdc1.nmrdc.nnmc.navy.mil (LCDR Michael E. Dobson) writes:
> ->[about a $250 autoshutdown monitor]
> ->
> ->The shell script to listen on the port and do the shutdown seems trivial;
> ->I'll post a copy of mine when I get it done, unless somebody beats me to it.
> 
> Why couldn't you just use a cheap relay connected to the mains power
> source.  Then connect pins 2 & 3 of the rs232 to a pair of contacts that
> are closed when power is on.  Then just send something out and see if it
> echos.  If it doens't come back to you, the power is off!
> 
> Or am I really overlooking something here?:

	Getting the "Edison is still making 60Hz waves" signal into the 
computer can be accomplished any number of ways. All of the above will 
work as will a photocell in a shoebox with a 15W light bulb. When the 
light goes out, we assume the power died etc. In fact the simplest way 
to do this is get a surplus "Plug-it-in-the-wall" DC supply of the 
type sold with calculators. Find a 9 -12V DC one and put a DB-25 on 
the DC end. Wire it so it asserts DSR. Or any damn pin you want as 
long as the system can look at it. When the power fails, it goes off 
(low). Then the computer knows that the power is down.

	That much is easy. This is the hard part. You now need a shell script 
to invoke shutdown before the UPS dies and negates the advantage of 
having one. But invoking shutdown, will still leave the system sitting 
there waiting for either a human to turn off the machine or the UPS 
power to die and cause havoc to the file system. Remember the purpose 
of this excercise is to prevent instant power loss damage.

	So what you have to do now is recognise the "Switch off or reboot" 
signal and kill the power with a relay. Of course the system could 
also have smarts that would abort shutdown if the power returned in 5 
mins etc. 

	The next problem is bringing the system back up again. So you need a 
way to access the relay remotely - via phone for example. Or you need 
a smart device to see that Utility power is back for  a set length of 
time - say 10 mins - and then switch the system back on.

	The whole purpose of this excercise is to take care of those times 
when the sysop is ill or away. Obviously if you are staring at the 
console and the room lights go out and the UPS kicks in, you know what 
to do.

	So to summarise, here is what needs to be done:

1.	Identify a power outage

2.	Start shutdown

3.	Abort shutdown, or reboot if power returns within a specified 
period.

4.	Switch off machine after shutdown is successful

5.	Switch machine back on after power has been restored for a certain 
length of time.

-- 
Julian Macassey, n6are  julian@bongo.info.com  ucla-an!denwa!bongo!julian
N6ARE@K6IYK (Packet Radio) n6are.ampr.org [44.16.0.81] voice (213) 653-4495

bernie@DIALix.oz.au (Bernd Felsche) (10/03/90)

In article <257@bongo.UUCP> julian@bongo.UUCP (Julian Macassey) writes:
[previous qoute deleted]
>	So to summarise, here is what needs to be done:
>
>1.	Identify a power outage
>
Easy via an RS-232 line monitor, of any religion you like.

>2.	Start shutdown
>
Shell script.
>3.	Abort shutdown, or reboot if power returns within a specified 
>period.
>
Shell script.
>4.	Switch off machine after shutdown is successful
>
RS-232 DTR line can be dropped, allowing a relay to drop out after a
nominal interval... no more power.

>5.	Switch machine back on after power has been restored for a certain 
>length of time.

Monitor power presence and after a safe delay (for the UPS to come
to a usable charge state), enable the computer's power relay.

All the above hardware can be put together with a few CMOS logic chips,
timers and passive components... oh and one or two relays.  Hardware
cost is about $30, maybe less.  Design time about 1 day.
Construction, depends.

If you prefer, send me US$3000 and I'll make one for you :-)

bernie

mason@oct1.UUCP (David Mason) (10/03/90)

In article <1030@bilver.UUCP> bill@bilver.UUCP (Bill Vermillion) writes:
>Why couldn't you just use a cheap relay connected to the mains power
>source.  Then connect pins 2 & 3 of the rs232 to a pair of contacts that
>are closed when power is on.  Then just send something out and see if it
>echos.  If it doens't come back to you, the power is off!

Or even easier.  Get a mains/25 volt ransformer (12 volt would probably
do, and can be bought off the shelf very easily) and wire the live 25
volts into DCD of a serial port.  Open the port with modem control. 
When the power drops, the port closes, and some program takes ap-
propriate action.  Haven't tried it, but it seems easy enough.
--------------------
David               |      mason@oct1.UUCP (David Mason)
                    |      olsa99!oct1!mason@ddsw1.mcs.com

~~~~~~~     Has your C2 locked you out today?    ~~~~~~~

jeffl@comix.UUCP (Jeff Liebermann) (10/04/90)

> having one. But invoking shutdown, will still leave the system sitting 
> there waiting for either a human to turn off the machine or the UPS 
> power to die and cause havoc to the file system. Remember the purpose 
> of this excercise is to prevent instant power loss damage.
> 
> 1.	Identify a power outage
> 2.	Start shutdown
> 3.	Abort shutdown, or reboot if power returns within a specified period.
> 4.	Switch off machine after shutdown is successful
> 5.	Switch machine back on after power has been restored for a certain 
> length of time.

Close.  I think most users have a rather odd illusion that the UPS is
a generic fix for most AC power related problems.  The implimentations
for shutdown previously mentioned only work under ideal conditions.
Last year, Santa Cruz survived an earthquake.  We learned a few new
lessons about computer reliability.  My conclusion is that the UPS
is only useful for MINOR power line disturbances.

1.  The power died about 20 seconds after the quake started.  During
these 15 seconds, the power was there but oscillating wildly.  Most
UPS's did NOT activate during this time.  The high frequency trash
went straight thru the UPS, filters, surge protectors, switching
power supplies, and ended up causing 2 hard disk controller cards to
lose step and eat the data on the hard disk.

2.  Two customers were in the middle of an automatic backup during
the quake.  In one case, the UPS kept the system up long enough to
complete the backup sucessfully only to have the computer, tape, and
UPS flooded with rusty water from the overhead sprinklers.  In the
2nd case, the hard disk bounced around so much, that both the
drives and the backup tape were garbage.

3.  Two other customers wished they didn't have UPS's.  The UPS
kept the drive running for about 30 minutes after the start of the
quake.  The shaking didn't stop for 5 MONTHS and we had regular
aftershocks.  The hard disks were literally pounded into uselessness
in the first few minutes.

4.  Swaying power lines were a real problem.  One area had a 15Kv
distribution line touch the local power line.  Everything turned on
and plugged in was vaporized.  The power was also erratic for weeks.
The problem wasn't when the power dropped off, but when it came back
on.  It usually appeared as a major hi-voltage spike.  MOV (metal-
oxide-varistor) type of surge protectors couldn't handle the energy
and either exploded or caught fire.   I lost 2 UPS's, 3 surge
protectors, and one computer this way.

These stories are only the ones related to UPS's.  My current opinion
is that what I really want is about 1 second of power "float" from
a large capacitor to take care of the transients.  The hard disk
should have a good brake on the spindle.  Longer than about 1 sec.
and the power to the computer drops IMMEDIATELY and stays off until
the power is absolutely stable for 10 minutes.  I care less about
trashed data, files, and such than a $$$$$ hole in my budget.  Any
of the previously mentioned "graceful" shutdown scripts will take
far too long to bring the system down before a quake, or the
power company take their toll.


-- 
# Jeff Liebermann   Box 272   1540 Jackson Ave   Ben Lomond  CA  95005
# (408)336-2558 voice  (408)429-0483 digital pager      CIS:73557,2074 
# PC REPAIR & RF DESIGN  uunet!comix!jeffl  ucscc.ucsc.edu!comix!jeffl
# universe!milky_way!solar_system!earth!na!us!uunet!comix!jeffl

bill@ssbn.WLK.COM (Bill Kennedy) (10/05/90)

In article <80@comix.UUCP> jeffl@comix.UUCP (Jeff Liebermann) writes:

I'm deleting a whole lot of this because it doesn't pertain to what I
have to say.  There are some potentially misleading statements about
"UPS" (uninterruptible power supplies) and while I'm not lashing the
author, I'm vigorously objecting to the misleading remarks.

[ ... ]
>
>Close.  I think most users have a rather odd illusion that the UPS is
>a generic fix for most AC power related problems.  The implimentations

A UPS is not only a generic fix for most AC power related problems, it's
a panacea.  With a true on-line UPS you have the utility powering a
battery charger and the battery being charged powering an inverter that
turns battery power into picture perfect AC power.  Emerson and other
manufacturers have promoted the notion that "standby" power supplies (SPS)
are UPS.  That's just not so.  An SPS passes the utility (most have some
noise filters in-line) straight through to the load until the utility
craters, then they switch on their inverter and make power from their
battery.  Everybody got the difference?  A UPS makes the AC your system
uses 100% of the time, SPS makes it only when the utility is gone.  Can
and do utility anomalies pass through SPS?  Definitely.  UPS?  Probably
not (though not impossible).

>for shutdown previously mentioned only work under ideal conditions.
>Last year, Santa Cruz survived an earthquake.  We learned a few new
>lessons about computer reliability.  My conclusion is that the UPS
>is only useful for MINOR power line disturbances.              SPS agreed!

>1.  The power died about 20 seconds after the quake started.  During
>these 15 seconds, the power was there but oscillating wildly.  Most
>UPS's did NOT activate during this time.  The high frequency trash

Is the difference becoming clear?  SPS wouldn't activate unless its
threshhold was met, UPS wouldn't activate because it doesn't need to
"activate", it's already running and AC input fluctuations aren't
interesting to a dull old battery.

>went straight thru the UPS, filters, surge protectors, switching
>power supplies, and ended up causing 2 hard disk controller cards to
>lose step and eat the data on the hard disk.

I believe it of an SPS, if it was a UPS then it was a Clary.  They are
the only ones I know who are careless enough to manufacture a UPS with
all of the genetic defects of an SPS.

Before you tune out, I'm typing this on a SunRiver workstation attached
to my 386/ix box.  This box is on an SPS, the box it connects to is on
a true on-line UPS.  SPS has its purpose, I've got two of 'em, $400 a
pop.  UPS has its purpose, I've got one of 'em, $5,000 a pop.  Am I rich?
Absolutely not!  Am I paranoid?  Absolutely!

>2.  Two customers were in the middle of an automatic backup during
[  I don't know beans about their set up, I'm sorry they lost data ]
>
>3.  Two other customers wished they didn't have UPS's.  The UPS
>kept the drive running for about 30 minutes after the start of the
>quake.  The shaking didn't stop for 5 MONTHS and we had regular
>aftershocks.  The hard disks were literally pounded into uselessness
>in the first few minutes.

There's precious little that an electrical circuit, good or bad, can
do about physical vibration.  Accordingly, I'm not sure if this is a
complaint or not, if it is a complaint, it's bogus (physical vs
electrical abuse).

>4.  Swaying power lines were a real problem.  One area had a 15Kv
>distribution line touch the local power line.  Everything turned on
>and plugged in was vaporized.  The power was also erratic for weeks.

That's one nice thing about a bona-fide UPS, it swallows all of
those anomalies into that huge multi-farad capacitor, the battery.

>The problem wasn't when the power dropped off, but when it came back
>on.  It usually appeared as a major hi-voltage spike.  MOV (metal-
>oxide-varistor) type of surge protectors couldn't handle the energy
>and either exploded or caught fire.   I lost 2 UPS's, 3 surge
>protectors, and one computer this way.

He lost two SPS's and everything else.  Let's add this up.  Let's say
that an SPS is $400, a surge protector is $20, and a computer is
$2,000.  My arithmetic says that this adds up to $2860.  It all
got (I'm sorry for that) toasted, so he gets to spend another $2860
and he's still naked!  A "real" on-line UPS, 3KVA (over 3,000 watts)
runs about $5,000.  Whoosh?  It's less than twice $2860.  It depends
on how serious you are about reliability and your data.

>These stories are only the ones related to UPS's.  My current opinion
>is that what I really want is about 1 second of power "float" from
>a large capacitor to take care of the transients.  The hard disk
>should have a good brake on the spindle.  Longer than about 1 sec.
>and the power to the computer drops IMMEDIATELY and stays off until
>the power is absolutely stable for 10 minutes.  I care less about
>trashed data, files, and such than a $$$$$ hole in my budget.  Any
>of the previously mentioned "graceful" shutdown scripts will take
>far too long to bring the system down before a quake, or the
>power company take their toll.

There's *nothing* electronic that I've seen advertised that will sense
an earthquake.  I guess you could build something up from an old Mk XIV
torpedo fuze that might start a shutdown when the tremblor started, but
a bona-fide on-line UPS would pay for itself in a hurry if you're truly
serious about a $$$$$ hole.  If you didn't buy the right stuff, you're
not lost (I have and use two SPS' here) but get a true UPS.  If you
don't get a true UPS, quit bellyaching and I'll quit preaching :-)

># Jeff Liebermann   Box 272   1540 Jackson Ave   Ben Lomond  CA  95005
># (408)336-2558 voice  (408)429-0483 digital pager      CIS:73557,2074 
># PC REPAIR & RF DESIGN  uunet!comix!jeffl  ucscc.ucsc.edu!comix!jeffl
># universe!milky_way!solar_system!earth!na!us!uunet!comix!jeffl
-- 
Bill Kennedy  usenet      {att,cs.utexas.edu,sun!daver}!ssbn!bill
              internet    bill@ssbn.WLK.COM   or attmail!ssbn!bill

dougp@ico.isc.com (Doug Pintar) (10/06/90)

In article <1794@ssbn.WLK.COM> bill@ssbn.WLK.COM (Bill Kennedy) writes:
>
>He lost two SPS's and everything else.  Let's add this up.  Let's say
>that an SPS is $400, a surge protector is $20, and a computer is
>$2,000.  My arithmetic says that this adds up to $2860.  It all
>got (I'm sorry for that) toasted, so he gets to spend another $2860
>and he's still naked!  A "real" on-line UPS, 3KVA (over 3,000 watts)
>runs about $5,000.  Whoosh?  It's less than twice $2860.  It depends
>on how serious you are about reliability and your data.
>

There ARE much cheaper on-line UPS (NOT SPS) options available.  I've got
one by Unison (their PS6.0 model, rated for a 600W system at normal load for
10-15 minutes) that cost $465 locally.  It has a built-in relay for playing
whatever kind of system-notification tricks you want when the power fails.
It's about the same footprint as a standard AT box and is designed to sit on
top of one, with the monitor on top of that.  The thing that REALLY sold me
was that it has a light on the front that comes on to illuminate the
keyboard when the power fails.  :-)  Cute touch, though.  It's gotten me
through several lightning-related outages and surges with nary a hiccup.
They DO say the battery should be replaced every couple of years, at a
"nominal" (tho I haven't inquired as to HOW nominal that might be) charge.
They make models ranging from 450 to 1000 watts (maybe higher) at (local,
sale) prices of (US) $410-760 (regularly 455-850).  Not a corporate
recommendation, just a satisfied customer speaking.  Good power protection
needn't cost kilobucks if you don't need it to run major systems for hours
on batteries.  My configuration is fairly chunky (a server situation), but
most outages in the area are 5 minutes long or less.  Most Unix PCs could
probably do with a smaller UPS than I use.
DLP

p.s. I DON'T plug the laser printer into the UPS.  It's on a separate surge
protector, as it draws 600W all by its lonesome when it prints.  I can live
without it during a power failure!
D

nvk@ddsw1.MCS.COM (Norman Kohn) (10/07/90)

In article <80@comix.UUCP> jeffl@comix.UUCP (Jeff Liebermann) writes:
>> [discussion of automatic detection of powerfailure and unattended
>> shutdown]...
>Close.  I think most users have a rather odd illusion that the UPS is
>a generic fix for most AC power related problems.  The implimentations
>for shutdown previously mentioned only work under ideal conditions.
>Last year, Santa Cruz survived an earthquake.  We learned a few new
>lessons about computer reliability.  My conclusion is that the UPS
>is only useful for MINOR power line disturbances.
> [recent earthquake and the associated power surges and fluctuations
> killed systems regardless of UPS backup]

OK, so we can't count on our UPS's to protect us against THE BIG
ONE.  Meanwhile, we need to take care of mundane, everyday
things like downed lines, the janitor tripping on the cord,
or (here in Chicago) Commonwealth Edison's inability to
keep the power up reliably.  It's certainly true, however, that
the power can do bad things besides dropping off line.
The systems that run off the battery full-time instead of
tripping an inverter when the line voltage drops should
give better protection, but take their toll in cost, noise,
and size.  As for sprinkler damage (not to mention theft): 
there's a reason why people recommend storing a set of tapes off-site.
-- 
Norman Kohn   		| ...ddsw1!nvk
Chicago, Il.		| days/ans svc: (312) 650-6840
			| eves: (312) 373-0564