Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mel.aone.net.au!grumpy.fl.net.au!news.webspan.net!www.nntp.primenet.com!nntp.primenet.com!news.mathworks.com!news.sprintlink.net!news-peer.sprintlink.net!news.sprintlink.net!news-hub.sprintlink.net!news.sprintlink.net!news-dc-9.sprintlink.net!news.sprintlink.net!news-dc-10.sprintlink.net!newsie.dmc.com!news.ziplink.net!rtfm.ziplink.net!mi From: mi@rtfm.ziplink.net (Mikhail Teterin) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Dumb UPS and old modems (was Re: APC Smart-UPS v/s Software) Date: 30 Jan 1997 05:12:46 GMT Organization: Aldan at Newton Upper Falls Lines: 41 Message-ID: <5cpake$csn$1@news.ziplink.net> References: <32e95f43.45703147@news.netonecom.net> <87vi8lfa2l.fsf@phobos.walker.org> Reply-To: mi@ALDAN.ziplink.net..remove-after-`net' NNTP-Posting-Host: 199.232.255.52 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Newsreader: knews 0.9.8 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:34736 Honorable Keith Walker wrote on 26 Jan (in article <87vi8lfa2l.fsf@phobos.walker.org>): =If you don't need anything fancy, then why not hook the computer up to =the UPS, and then hook up some old 2400 bps modem to the unconditioned =power. Now, configure that modem so that it always asserts the DCD =line, which should be possible with any Hayes-type modem, then write =some little daemon that just opens that modem port and waits for a =character. When the power goes off, the computer will keep going, but =the modem will shut off, cuasing the DCD to be lowered, invoking a =SIGHUP to your little daemon. The daemon then performs a shutdown. = =I used this method back before there were such things as =smart-UPS's. I realize it's a ridiculous waste of both a serial port =and the UPS's capabilities, but you *did* say you didn't want anything =fancy :-) Well, the serial port will be wasted one way or another, but this wonderfull method enables the use of _all_ types of UPS with FreeBSD (or any other Unix (other OSes?)), with a non-needed device serving as a power sensor. Seems like the trivial daemon can be written in sh: #!/bin/sh chat ... whatever is needed to make modem do DCD ... cat < /dev/ttyXXX # After hangup Do the shutdown Please, correct me if I am wrong... And, of course, "Do the shutdown" may, say, wait another 10 minutes (or whatever the UPS' capacity is estimated to) check for the power again, etc. Or, to avoid keeping an extra process (cat) around, make sh itself read the /dev/ttyXXX (how?) after setting `trap "Do the shutdown" 1'... If the above make some sence, can the shell/modem guru write a more sensible example, please? Thanks! -mi -- "Windows for dummies"