[comp.unix.questions] 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?    ~~~~~~~