From: jkaidor@synoptics.com (Jerome Kaidor) Subject: Automated Linux PowerDown Date: 14 Apr 1993 21:51:51 GMT
A few weeks ago, I cut my home uucp node over to linux. Goodbye, Dos! And good riddance.
Now uucico runs off a crontab that periodically checks for outgoing mail, occasionally polls for
incoming mail, and in general, chugs away in the background. I even turned the sound off on
the modem, so that uucico's entry onto the PSTN is announced by a mere *click*. Just like a real
network!
Now, for my purposes, linux has only one disadvantage, as compared to dos. I'd like to address
it: with DOS, you can generally dump the computer's power any time that you see that dos prompt.
With any unix, you have to be more careful... Why is this important?
Previously, my computer was on a 24-hour timer, which turned it on at 3:00 in the morning
( or thereabouts ), and turned it off at 5:00 AM ( or so ). The intervening two hours were enough
for the machine launch uucico and pick up my mail. Then during the day, I would turn the computer
on manually, and do my usual stuff.
According to my calculations, leaving the computer on 24 hours/day will eat $10-$20 worth of
electricity. I, personally, have no problem with this, but my wife might well disagree.
Accordingly, I have thought up the following hardware/software solution:
1) I build a box that allows the computer to turn itself *off*.
2) I let the 24-hour timer turn the computer *on*.
3) A cron script turns the computer off if:
a) The computer has been on for a few hours ( or maybe, that the automated nighttime tasks are finished )
b) It's early in the morning ( 4:00 AM or so )
c) There are NO USERS ( nobody logged in )
Of course, a software-only solution is possible, where a crontab just syncs and halts the computer
when the conditions are met, but I don't like this because:
1) The computer and timer could get out of sync, and the timer could power-down in the middle of something.
2) The computer would always be turned on much longer than necessary to do its actual work.
For the hardware part of this solution, I prefer to keep it simple. I would still use the mechanical 24-hour
timer, but set it so that it only supplied power for a little while, say, 15 minutes. It would plug into a box,
built by me, that would contain a relay to bypass the timer as soon as power came on. The relay would be
turned off by a circuit that looked at an output of the computer. But what output?
I was thinking of using one of the DTR lines on the serial ports. Trouble with them, is that you really don't know
what will happen to them during bootup, etc. One glitch, and BZZZzzzzz*. My solution to the problem of unknown
states and glitches is to place some very specific requirements on the computer's output. Specifically, a simple circuit
consisting of a comparator, a couple of capacitors, a resistor or two, and a diode, would make the turn-off circuit only
trip when a large group of *pulses* came out of the computer. Now, it's probably not usual to see
a couple thousand pulses come out of a DTR output, is it?
Anybody have any comment on all this? I'm sorry, it's not totally Linux-specific, but I figured that some other linux'ers
out there might be interested, too.. I don't think my situation is all that unusual.
- Jerry Kaidor ( tr2!jerry@dragoman.com, jkaidor@synoptics.com )