*BSD News Article 35663


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.Hawaii.Edu!ames!hookup!news.kei.com!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!gatech!purdue!haven.umd.edu!umd5.umd.edu!jjarray.umd.edu!fcawth
From: fcawth@jjarray.umd.edu (Fred Cawthorne)
Newsgroups: comp.os.386bsd.development
Subject: Re: UPS driver/daemon/utils
Date: 1 Sep 1994 13:33:38 GMT
Organization: Center for Superconductivity Research - Univ. of Maryland
Lines: 31
Message-ID: <344l7i$lld@umd5.umd.edu>
References: <hm.777584469@hcswork>
NNTP-Posting-Host: jjarray.umd.edu
X-Newsreader: Tin 1.1 PL4

hm@hcswork.hcs.de (Hellmuth Michaelis) writes:
: What follows is a package to handle a uninterruptible power supply
: built into a PC running FreeBSD 1.1R.
: 
[stuff deleted]
: 
: If someone has a better idea, i'd like to hear about it!

Well, I don't know about better, but different anyway...

I use a serial port to monitor the UPS, as is commonly done.
A process sits and watches CD, sleeping most of the time.
When the power fails, the process waits for a minute to make sure 
it wasn't just intermittant.  Then, it begins the reboot process.
I hacked the reboot code in the kernel to assert DTR and wait a few
seconds right before it reboots the machine.  My UPS has a signal that
lets it shut off if the main power is down, conserving battery life.
Thus, FreeBSD will shut down, and then turn the computer off.
When the power comes back up, it reboots and the UPS has enough battery
life left to go through a few more reboot cycles.  I didn't want 
to run the UPS batteries down, since if the power comes back on 
for a short period of time, then dies again, the system might not be
in a state where it can shut down easily. (i.e. if it is booting...)
Anyway, I think this type of scheme is commonly used on file servers
and the like..  Some UPS's don't have this power shut-off input, so
I guess then you just have to hope the power doesn't do wierd things.
Maybe somene could add an "OPTIONS DTRBOOT" or something like that
to the kernel config???

Fred.