Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!ihnp4.ucsd.edu!news1.ucsd.edu!nothing.ucsd.edu!brian From: brian@nothing.ucsd.edu (Brian Kantor) Newsgroups: comp.unix.bsd.bsdi.misc Subject: Re: UPS recommendations for BSD systems Date: 14 Dec 1995 19:26:18 GMT Organization: The Avant-Garde of the Now, Ltd. Lines: 25 Message-ID: <4aptoq$500@news1.ucsd.edu> References: <4an40p$bvs@morgoth.sfu.ca> <4anaum$ajk@moon.igcom.net> NNTP-Posting-Host: nothing.ucsd.edu A simple way to interface a UPS to BSDI (or any similar operating system) is via an unused serial port that has modem control signals available on it. Trick is this: if you attempt to open a serial port and there's nothing connected to it, your program winds up raising DTR (pin 20 on the usual connector) and then blocking until DCD (carrier detect on pin 8) comes on. Use the relay contacts in the UPS to connect pin 20 to pin 8 so that when the UPS signals that it's about out of battery power, the UPS relay connects the pins together, signalling an imminent power fail. Typically you have 1 to 5 minutes when this happens, which is plenty of time to shut down the system in an orderly fashion. Then you just fire off a program at system startup that attempts to open that serial port, and if the open ever succeeds, shuts down the system. Something like this: #!/bin/sh cat /etc/motd > /dev/tty1 shutdown -h now power fail I know, I know, too simple. - Brian