Date: Tue, 26 Jun 2001 03:04:40 -0700 From: "Ted Mittelstaedt" <tedm@toybox.placo.com> To: "Andrew Reid" <andrew.reid@plug.cx>, <freebsd-questions@FreeBSD.ORG> Subject: RE: FreeBSD and surviving unclean shutdowns Message-ID: <001e01c0fe27$69f334e0$1401a8c0@tedm.placo.com> In-Reply-To: <993521648.1058.8.camel@percible.alfred.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
Andrew, You want to get a UPS that has a signal cable and set up your FreeBSD server to gracefully shut down. However, if you already have a UPS that for budgetary reasons you can't replace, then it's rediculously easy to add signalling to it. All you need to do is get a 120 volt (or 220 volt if your in Europe) relay from any electronics supplier and wire this on your UPS AC input power. Then take the normally closed contacts (which will be open when the AC to the UPS is on) and connect one to DTR and the other to CD (Carrier Detect) on an unused serial port. Then you write a simple script that starts by attempting to open the serial port callin device. On successful open it issues the command "shutdown -p" (obviously your server must support -p) In operation, when the relay sees line voltage the NC contacts will be open, and the CD line will not be high. Thus the script will pause waiting for the serial port to open. Once you lose AC power the NC contacts will close and the CD line will go high, the script will open the serial port then shut down your system. The only problem with all this is that once the system shuts down it won't automatically power back up. (if it's a soft power up system) It might also be possible, depending on your UPS, to add signalling by measuring the 12 volts directly across the battery terminals. What you would do is get a 12 volt relay that uses the lowest current that you can find, then wire this in series with a 100 Ohm potentiometer directly across the battery terminals. Then with UPS batteries fully charged, you unplug the UPS from AC and while it's running on battery power, you adjust the potentiometer until the relay contacts open, then back the adjustment up somewhat. The idea here is that with ordinary lead-acid UPS batteries, as they are discharged their output voltage gets lower and lower until the battery is completely discharged. But, this may not work because the relay draw may interfere with the UPS charging circuit, (making the UPS think the batteries are never fully charged) or the UPS may decide to shut down before the battery voltage has changed enough for the relay to open. Any experimentation that anyone does in this area would be most interesting. Ted Mittelstaedt tedm@toybox.placo.com Author of: The FreeBSD Corporate Networker's Guide Book website: http://www.freebsd-corp-net-guide.com >-----Original Message----- >From: owner-freebsd-questions@FreeBSD.ORG >[mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Andrew Reid >Sent: Monday, June 25, 2001 7:14 PM >To: freebsd-questions@FreeBSD.ORG >Subject: FreeBSD and surviving unclean shutdowns > > >While I am resurecting one of my mail servers (which is currently >running Linux) the thought crossed my mind "How would FreeBSD cope with >this situation?" > >This server is running Software-RAID on a (patched for RAID) 2.2 kernel, >and last night, the power went out for about three hours. My UPS only >lasted for 2 of them. > >How does FreeBSD cope with these sort of things? My Cache server took >about an hour-and-a-half of fsck.ext2'ing to come back to a useable >state. > >My primary mail server, as I said is still in pieces and being >resurected now. I've been contemplating bringing the mail over to >FreeBSD, but haven't as yet as I've still got to port some PAM stuff >that we wrote for Linux. > >Can someone please comment on this? > > - andrew > >-- >void signature () { > cout << "Andrew Reid -- andrew.reid@plug.cx" << endl ; > cout << "Cell: +61 401 946 813" << endl; > cout << "Quidquid latine dictum sit, altum viditur" << endl; >} > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001e01c0fe27$69f334e0$1401a8c0>