[comp.unix.questions] Followup to: UPS initiated autoshutdown

norstar@tnl.UUCP (Daniel Ray) (07/08/89)

Hi. A few weeks ago I posted an article here asking about a daemon that would
sense a power failure and initiate an automatic shutdown within a controllable
period of time. This would be used in conjunction with an uninterruptable
power supply (battery backup) so the system could be brought down cleanly
while power was still available thru the UPS. This was in the wake of a full
hard disk destruction after a power failure, and we were not to be burned
again.

I received an enormous number of inquiries from people who wanted to know
how to implement this!

Here on The Northern Lights, we have solved the problem (getting a UPS),
and are about to solve the autoshutdown daemon issue also. Several guidelines
went into TNL's decision:

 a. Money *was* an object. TNL charges no fees, and I don't make very much
thru my job, so getting a good deal was a central factor. I expected to
make the purchases thru mail order, a method I am familiar with (and have
saved literally $1000s of dollars!).

 b. Both a UPS and the power failure sensor/autoshutdown daemon would have
to be obtained. Some UPSs implement both functions, others need a seperate
sensor/daemon. The minimum wattage needed to be 450 watts, enough to provide
10 minutes of backup for an Acer 1100 (386 AT clone), an EGA console monitor,
and an Avatex 2400 external modem. The CPU uses about 190 watts, so 450 adds
a comfortable measure of reserve. As for the power sensor/shutdown daemon,
the sensor would HAVE TO communicate with the daemon via an unused serial
port. TNL has plenty of those, but not one available slot on the motherboard,
which is the other way some of the sensors work. The UPS was expected to
possess surge suppressor and voltage regulation capability in addition to
the power failure backup.

The printer and other external peripherals would NOT be on the UPS
protected circuit. UPSs come in all shapes and sizes starting at 200
watts thru 2000 or more. 200 turns out to be pathetically insufficient
protection for a UNIX size PC. We desired an audible power failure alarm
for the UPS, and often the 200 watt units don't include this feature.


So, I went thru about 60 mail order ads, and found a wide divergence of
prices for the same unit. Finally we decided on the following two
purchases:

1. A TrippLite 450 Watt battery backup power supply (model BC-450), costing
$299 thru Advanced Computer Products (714-558-8813). This same unit cost
from $100 more up to nearly $600 thru other mail order companies, so watch
out! Often almost all ads will be around the same price, but there will be
ONE company that offers something $100 less, and is easy to miss. This UPS
provides 10-30 min of protection, has an audible alarm, a circuit breaker
to protect against overloads, voltage regulation, square wave AC during
battery power (some say this is not as good as pure sine waves, others say
that square is better for electronic equipment, don't know which to believe).
Other UPSs were available having more wattage, or a power sensor/daemon
feature, often using a motherboard slot. They were much more expensive.
The TrippLite is good for around 5 years or up to 500 battery/recharge
cycles, and the manufacturer warns to always leave it plugged in or the
battery can become damaged. Unfortunately the TrippLite does NOT have
power sensor/autoshutdown capabilities, nor is this a separate option you
can buy from the company (that we know of).

2. We are about to get Showdown unattended shutdown software/sensor from
Continental Information Systems, 320 W. Irving Park Rd, Itasca, IL 60143
(312-250-8111). This provides a device that plugs in and connects with
a serial port for XENIX, 3B2, or System V/386 UNIX, and the daemon
software which is configurable. TNL can't vouch for this one since we
haven't done it yet. The cost is $195 right now.

We tested the UPS and it works beautifully, seems well-made and reliable.
There are a lot of TrippLites out there, and I think I'll be very satisfied
with it. (This message is not an advertisement, but a case history, telling
what we actually did. You may be able to find a better deal somewhere else).
Up until last week, we thought we'd have to write the daemon portion or
get one written by a couple of people who sent mail, but then discovered
item 2 above in Unix World. The price isn't bad, it solves the hardware
sensor issue, so we'll go with that once I get another bunch of cash to
part with.

It's good to be giving so you should part with the cash whenever you can!
"Power" to the people! :@)

norstar
The Northern Lights, Burlington Vermont             |      
tnl dialins: 802-865-3614 at 300-2400 bps.        ` | /    
------------------------------------------      --- * ---  
uucp: uunet!uvm-gen!tnl!norstar or                / | .    
{decvax,linus}!dartvax!uvm-gen!tnl!norstar          |      

fr@icdi10.UUCP (Fred Rump from home) (07/09/89)

In article <216@tnl.UUCP> norstar@tnl.UUCP (Daniel Ray) writes:

[deleted stuff]
>1. A TrippLite 450 Watt battery backup power supply (model BC-450), costing
>$299 thru Advanced Computer Products (714-558-8813). This same unit cost
[deleted stuff]
>provides 10-30 min of protection, has an audible alarm, a circuit breaker
>to protect against overloads, voltage regulation, square wave AC during
>battery power (some say this is not as good as pure sine waves, others say

Test your up time and see how long you really stay up.

Personally, I wish you the best of luck but we've long ago given up on 
inexpensive units like the TrippLite. When you sell UPS systems to customers 
it's like selling an insurance policy. And when they don't perform - boy are 
you up shits creek. We found that we need minimum of 450 watts and sine wave 
units. The square ones just don't seem to kick in in time all the time. Then 
what have you got? Nothing but a big battery that clucks at you.

We've come to expect to pay about a dollar a watt and then can expect good 
service. We have every one of over 100 Xenix/Unix systems on a UPS and 
wouldn't begin to accept any kind of service or warranty without it. We 
learned these lessaons the hard way out in the field. Electronics seems to run 
forever if you protect it from the vagaries of the outside electrical world.

>2. We are about to get Showdown unattended shutdown software/sensor from
>Continental Information Systems, 320 W. Irving Park Rd, Itasca, IL 60143
>(312-250-8111). This provides a device that plugs in and connects with
>a serial port for XENIX, 3B2, or System V/386 UNIX, and the daemon
>software which is configurable. TNL can't vouch for this one since we
>haven't done it yet. The cost is $195 right now.

With this extra expense you could have gotten one of the units that would 
have given you automatic protection. American Power comes to mind. There are 
several others but we really don't bother with the auto-shutdown units. When 
the power problems occur during the day, folks can normally shut down when 
they see the lights have gone off. This saves precious databases. During the 
night... so what? The systems will autoreboot anyway and no harm is done.

fr
-- 
This is my house.   My castle will get started right after I finish with news. 
26 Warren St.             uucp:          ...{bpa dsinc uunet}!cdin-1!icdi10!fr
Beverly, NJ 08010       domain:  fred@cdin-1.uu.net or icdi10!fr@cdin-1.uu.net
609-386-6846          "Freude... Alle Menschen werden Brueder..."  -  Schiller

karl@ddsw1.MCS.COM (Karl Denninger) (07/10/89)

In article <216@tnl.UUCP> norstar@tnl.UUCP (Daniel Ray) writes:
>
>Hi. A few weeks ago I posted an article here asking about a daemon that would
>sense a power failure and initiate an automatic shutdown within a controllable
>period of time. This would be used in conjunction with an uninterruptable
>power supply (battery backup) so the system could be brought down cleanly
>while power was still available thru the UPS. This was in the wake of a full
>hard disk destruction after a power failure, and we were not to be burned
>again.
>
>I received an enormous number of inquiries from people who wanted to know
>how to implement this!

We have software available to do this if you're running SCO Xenix.  It works
off an unused serial port.  SCO Xenix will handle two different signals --
line failure AND low battery -- making the shutdown operate only when the
UPS says it's about to poop out. 

We also have the same for 386/ix, but it won't do the second signal
monitoring -- thus you can only have a timed delay on 386/ix.

The software requires that you have a switched output from the UPS which
indicates these conditions.  The output absolutely must be isolated from the
cabinet of the UPS and other hardware -- there are a few UPSs out there
which don't do this; they short a line to cabinet ground through a pass
transistor -- these will NOT work.  Tripplite UPSs are ok; American Power
Conversion units will only provide one signal in this fashion.

You run the software from the "rc" scripts which start the system up; it
automatically backgrounds itself and will report status changes to the
console.  All terminals which are signed on will also be notified when the
utulity power goes off, if a shutdown is cancelled (by utility power being
restored), and just before the final shutdown is done.

Contact us for more details at (312) 566-8910 or send email.

--
Karl Denninger (karl@ddsw1.MCS.COM, <well-connected>!ddsw1!karl)
Public Access Data Line: [+1 312 566-8911], Voice: [+1 312 566-8910]
Macro Computer Solutions, Inc.		"Quality Solutions at a Fair Price"

cals@cals01.NEWPORT.RI.US (Charles A. Sefranek) (07/19/89)

In article <1989Jul9.193016.9426@ddsw1.MCS.COM> karl@ddsw1.MCS.COM (Karl Denninger) writes:
>In article <216@tnl.UUCP> norstar@tnl.UUCP (Daniel Ray) writes:
>>
>>Hi. A few weeks ago I posted an article here asking about a daemon that would
>>sense a power failure and initiate an automatic shutdown within a controllable
>>period of time. This would be used in conjunction with an uninterruptable
>>power supply (battery backup) so the system could be brought down cleanly
>>while power was still available thru the UPS.  ...

Something about this always bothered me -- is there any way to tell the UPS
to turn off after the computer has been shutdown cleanly?  It seems a shame
to run the UPS battery into the ground during a prolonged power outage,
especially if the computer could be safely powered down at that point. This
assumes of course that everything is unattended, like at 2:00 AM on a cold
winter day with three feet of fresh snow covering your driveway.. :-)
-- 

--
 Charlie Sefranek	cals@cals01.NEWPORT.RI.US
UUCP: {rayssd,xanth,lazlo,mirror}!galaxia!cals01!cals
Alt.: c4s@rayssdb.ray.com {sun,decuac,gatech,necntc,ukma}!rayssd!rayssdb!c4s

norstar@tnl.UUCP (Daniel Ray) (07/20/89)

In article <462@cals01.NEWPORT.RI.US>, cals@cals01.NEWPORT.RI.US (Charles A. Sefranek) writes:
> 
> Something about this always bothered me -- is there any way to tell the UPS
> to turn off after the computer has been shutdown cleanly?  It seems a shame
> to run the UPS battery into the ground during a prolonged power outage,
> especially if the computer could be safely powered down at that point. This
> assumes of course that everything is unattended, like at 2:00 AM on a cold
> winter day with three feet of fresh snow covering your driveway.. :-)
> --
>  Charlie Sefranek	cals@cals01.NEWPORT.RI.US
> UUCP: {rayssd,xanth,lazlo,mirror}!galaxia!cals01!cals

This and an email message I received pointed out several less-than-desirable
outcomes for a UPS-protected system during a blackout, as I have in place on
my system. I'll go through them now:

A. Single very short duration power glitches (95% of all failures are this
type here in Burlington). The power goes out for a few seconds. The UPS
switches to battery power and then back to AC. The system would not know that
anything happened, most likely. The UPS battery is not drained much.

B. Long duration blackouts (2% likely here in Burlington). The power goes out
and stays out for at least 20 minutes. The system senses the failure via a
test thru a serial port every minute. Users are warned, and the daemon waits
to retest after another minute. Meanwhile, the UPS is switched to battery
power. The daemon tests again, finds power still out, so starts the auto-
shutdown sequence, leading to shutdown 60 seconds later. Now the system is
down, but not turned off physically. Battery power continues to drain, until
after 10-20 minutes the UPS shuts off power to prevent the battery from
being overdrained. This shuts off the CPU. Sometime later, power is restored.
The system restarts as from a power off condition, reboots, and is up. The
UPS slowly recharges its battery, but this takes hours. The weakness is that
a second power failure would occur, and that the system would not have the
minimum 2-3 minutes required for shutdown, causing a crash. If the system
knew that it just came up from a power failure, it could change the daemon
to use 'haltsys' at the first sign of a second blackout. After say a day,
it could go back to the normal 2 minute cycle. (This also demonstrates the
wisdom of using only a very short waiting period between when the daemon
senses an outage and when it starts a shutdown. I think 1 minute is good,
so that a second power failure with a partially recharged UPS battery might
last long enough for system shutdown).

C. Intermediate duration outages (3% likely). The power is off for from two
to twenty minutes, such that the UPS battery power is never out, but the
system *did* shutdown via the daemon process. The UPS is never overdrained,
but the system never reboots either. After the AC power is restored, the
system continues to sit there until a human intervenes. This is not very
likely since virtually all power failures are of type A above. But if it
happens, no provisions are in place to restart the system.

Probably some more expensive UPSs are available that can deal with type C.
But by protecting against the very short failures, I still protect the
system almost fully from blackouts. Almost.

I think that I am going to create the power sensor/daemon myself. I need
to save money, and I'll learn something. If I come up with anything good,
I'll give it to the net.

norstar
The Northern Lights, Burlington Vermont             |      Awaking from a
tnl dialins: 802-865-3614 at 300-2400 bps.        ` | /    dream of waking
------------------------------------------      --- * ---  up. Dream of a
uucp: uunet!uvm-gen!tnl!norstar or                / | .    dream of a dream!
{decvax,linus}!dartvax!uvm-gen!tnl!norstar          |      

morrison@ficc.uu.net (Brad Morrison) (07/20/89)

In article <462@cals01.NEWPORT.RI.US>, cals@cals01.NEWPORT.RI.US (Charles A. Sefranek) writes:

> . . . is there any way to tell the UPS
> to turn off after the computer has been shutdown cleanly?  It seems a shame
> to run the UPS battery into the ground during a prolonged power outage,
> especially if the computer could be safely powered down at that point. This
> assumes of course that everything is unattended . . .

Hopefully, your UPS will have such a feature.  We use BEST's
Micro-FERRUPSs, which provide several commands for different types of
timed shutdowns.  You just tell the UPS to shut down in, say, two minutes,
then shut down all systems connected to the UPS (in a fashion that will
take less than two minutes.  :-)

Another consideration is whether your UPS will restart itself when power
returns, and in which cases.  What if power returns before the two minutes
is up?  What if power returns after everything has been shut down, and your
UPS gives AC to every connected device, but the resulting power surge
causes insufficient AC to be delivered to one or more of the devices, which
is highly sensitive in this respect . . . some UPSs which support timed
shutdowns don't support configurable restarts.
-- 
"Caution:  Cutting edge is sharp.| Brad Morrison                (713) 274-5449
           Avoid contact."       | Ferranti International Controls Corporation
                -- Handi Wrap box| uunet!ficc!morrison    morrison@ficc.uu.net

bks@ALFA.berkeley.edu (Brad Sherman) (07/21/89)

In article <217@tnl.UUCP> norstar@tnl.UUCP (Daniel Ray) writes:
>B. Long duration blackouts (2% likely here in Burlington). The power goes out
>and stays out for at least 20 minutes. The system senses the failure via a
>test thru a serial port every minute. Users are warned, and the daemon waits
>to retest after another minute. Meanwhile, the UPS is switched to battery
>power. The daemon tests again, finds power still out, so starts the auto-
>shutdown sequence, leading to shutdown 60 seconds later. Now the system is
>down, but not turned off physically. Battery power continues to drain, until
>after 10-20 minutes the UPS shuts off power to prevent the battery from
>being overdrained. This shuts off the CPU. Sometime later, power is restored.
>The system restarts as from a power off condition, reboots, and is up. The
>UPS slowly recharges its battery, but this takes hours. The weakness is that
>a second power failure would occur, and that the system would not have the
>minimum 2-3 minutes required for shutdown, causing a crash. If the system
>knew that it just came up from a power failure, it could change the daemon
>to use 'haltsys' at the first sign of a second blackout. After say a day,
>it could go back to the normal 2 minute cycle. (This also demonstrates the
>wisdom of using only a very short waiting period between when the daemon
>senses an outage and when it starts a shutdown. I think 1 minute is good,
>so that a second power failure with a partially recharged UPS battery might
>last long enough for system shutdown).

When I was setting up business systems in Lafeyette, CA which has
brownouts when the humidity hits 70% and blackouts when the first
drop of water touches a PG&E transformer the rule of thumb was:

	After a power outage, do not restart the computer until
	power has been restored for a length of time equal to
	the length of the outage.

An empirical result dealing with outage "bursts."

Hearsay alert: I remember being  told that a UPS, which does an excellent job
of conditioning the power for the machine hanging off it can wreak havoc upon
power for other machines on the same main circuit (but not on the UPS).

		-- Brad Sherman(bks@ALFA.Berkeley.EDU)
---------

Not only do the opinions expressed herein not represent those of
the Regents of the University of California, but by the time you
read this they probably won't represent mine.