Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!ames!amdcad!sun!pitstop!sundc!seismo!uunet!ispi!jbayer From: jbayer@ispi.UUCP (Jonathan Bayer) Newsgroups: comp.unix.questions Subject: Re: UPS directed system shutdown info needed Message-ID: <431@ispi.UUCP> Date: 29 Jan 89 17:58:31 GMT References: <210@wa3wbu.UUCP> Reply-To: jbayer@ispi.UUCP (Jonathan Bayer) Organization: Intelligent Software Products, Inc. Lines: 34 In article <210@wa3wbu.UUCP> john@wa3wbu.UUCP (John Gayman) writes: > > Does anyone have experience with interfacing a small UPS system (600- >1000VA) to a 386-based Unix box to allow for orderly system shutdown >when the batteries run down ? > The UPSs I have worked with usually have an open/close switch. In other words, the switch is usually open, but closes when the power goes away. It could also be the other way around. What you want to do is to create a background daemon which will poll a serial port. The serial port will be hooked up to the ups, switching open the td and rd lines. In the case of the normally open switch, if the deamon is able to send a character out the port, and get it back, it will know that power has failed. In the case of the normally closed switch, when it fails to receive the character back it will know that power has failed. The daemon should poll at least once every two minutes (depending on the capacity of the UPS). When it detects a power failure it should notify all users that a system shutdown due to power failure is imminent, and start keeping time. If the power does not come back within a specified period of time, the daemon will do an orderly system shutdown. JB -- Jonathan Bayer Beware: The light at the end of the Intelligent Software Products, Inc. tunnel may be an oncoming dragon 19 Virginia Ave. ...uunet!ispi!jbayer Rockville Centre, NY 11570 (516) 766-2867 jbayer@ispi