Path: utzoo!attcan!uunet!van-bc!sl From: sl@van-bc.UUCP (pri=-10 Stuart Lynne) Newsgroups: comp.unix.questions Subject: Re: UPS directed system shutdown info needed Message-ID: <2163@van-bc.UUCP> Date: 22 Jan 89 09:52:56 GMT References: <210@wa3wbu.UUCP> <32@elgar.UUCP> <3149@ttrdc.UUCP> Reply-To: sl@van-bc.UUCP (pri=-10 Stuart Lynne) Organization: Wimsey Associates, Vancouver, BC. Lines: 35 In article <3149@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: >In article <32@elgar.UUCP>, ag@elgar.UUCP (Keith Gabryelski) writes: >< The second scenario is for any system that does not use an internal >< A daemon monitors a serial port for a message from the IPS tell it >< that the system is on battery power. Actually, the daemon blocks >I could see a possible problem with this if the port jams; the UPS could >go on battery power and the system would fail to notice, nor would it notice >the fact that the port had jammed. Mightn't it be better to have some kind >of continuous "self test" going on? A simple way to do this would be to have a little watchdog box, simply emitting a stream of characters at a known rate. If it is powered from the same supply as the UPS unit it will stop sending when the power goes out. All you need is a simple watchdog deamon under Unix to do a shutdown if it doesn't see a character on the appropriate port for a specified period of time. I'm sure that a reasonably good hardware type could design something appropriate in a few minutes using a 555 timer, garden variety UART, and appropriate glue parts. This would have the advantage of working easily with virtually any UPS without having to have something overly intelligent in it. The watchdog is very simple to write, set an alarm, read a char, loop. If the alarm ever goes off call shutdown. To keep things robust make the character rate about 1/5 of alarm time. For example if you have a twenty minute UPS (i.e. you can run twenty minutes from your UPS) and need ten to shut things down safely; set the watchdog alarm for five minutes, and watchdog hardware for one char per minute. -- Stuart.Lynne@wimsey.bc.ca {ubc-cs,uunet}!van-bc!sl Vancouver,BC,604-937-7532