Skip site navigation (1)Skip section navigation (2)
Date:      08 Aug 2001 13:00:57 -0700
From:      swear@aa.net (Gary W. Swearingen)
To:        Christopher Farley <chris@northernbrewer.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: rc.shutdown and SmartUPS
Message-ID:  <mm1ymmqq2u.ymm@localhost.localdomain>
In-Reply-To: <20010808121823.A96388@northernbrewer.com>
References:  <chris@northernbrewer.com> <200108080115.f781FnU45606@x4.tucheng.generalresources.com> <20010808013811.A61371@northernbrewer.com> <a6pua6qz7d.ua6@localhost.localdomain> <20010808121823.A96388@northernbrewer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Christopher Farley <chris@northernbrewer.com> writes:

> Gary W. Swearingen (swear@aa.net) wrote:
> 
> > I've been suprised that I've not seen anyone consider this before (when
> > I investigated about ten USP programs while using Linux).  Most seemed
> > more concerened about having their system get running again unattended.
> 
> Shutting the system down cleanly is easy, at least with NUT.
> Preparing it to boot up properly upon restoration of power was
> decidedly trickier.
> 
> At first I thought it would be enough to shut down the computer with a
> 'shutdown -h now'. Eventually, the batteries on the UPS would die and the 
> power to the computer would be cut. My computers are set to reboot once 
> the AC power returns.
> 
> But what happens in that odd case where the power comes back on after
> you've issued the shutdown -h, but before the UPS dies? The computer
> just sits there until someone reboots it. 
> 
> > I was concerned about the system trying to boot up and shut down while
> > the mains power was going on and off while the battery was near dead.
> > A small risk, but as I'm not running a server, one I needn't take.
> 
> NUT allows you to set the shutdown command to whatever you want. So
> if you don't care about it coming back up, you can do a shutdown -h, and
> at least your disks will be synced and dismounted properly.

Good. I hope I can use it to do the shutdown and still use my daemon to
handle the monitoring, user interface, etc.  I've got a dumb UPS and had
to wire up a cable and hack an old dumb upsd program to talk with the
right wires, etc.  I'll have to have the NUT shutdown script tell my
deamon to shut down the UPS, etc. as only it knows how to talk with my
UPS.

But your response above (and some other things you wrote) makes me
wonder if you "got" my concern.  If you use most of your UPS capacity
during the first power-outage/shutdown cycle you could conceivably
crash due to low voltage if power went out again while you were
rebooting after the first power outage. (Maybe it'd be OK if all of 
the UPS software gets going before disks are mounted; but it doesn't.)

The proper solution is probably to have pre-rw-mounting UPS software
that considers how long your UPS has had to recharge, etc.

I hope you don't mind me cc'ing much of your mail to the list.  I
thought your msg had some things to say about configuring NUT that
should be kept for archive searchers.

> > I still haven't figured how to shutdown properly in FreeBSD as it seems
> > more of the shutdown process happens in "init" (as opposed to scripts)
> > than in Linux where I could change a script to shut down the UPS after
> > the disks are unmounted.   I was planning to write a script to shutdown
> > the Linux way.  I'll have to look into the software you're discussing.
> 
> NUT is pretty nice, it's under active development, and it supports a
> huge variety of UPS devices. There's even cgi scripts that allow you to
> monitor the status of your UPS(es) remotely.
> 
> I found NUT a bit tricky to configure initially. It requires that you run
> three daemons: a driver daemon specific to your UPS; upsd, which
> communicates with the driver and authenticates listeners; and upsmon, which 
> monitors the status of the UPS and sends out messages if certain events 
> occur. Optionally, a forth daemon does logging, which is pretty useful
> if you want to see how long it takes for your batteries to dissipate
> and recharge...
> 
> It took me a while to realize that the driver daemon wants to create a
> file in /var/db, and it does not have permissions to do so. The solution
> is to 'touch' the file as root, and change the ownership and permissions
> as desired. That was about the only major undocumented installation issue.
> 
> To shut down the UPS you run the driver with the -k option. It takes a 
> few seconds for it to send the shutdown command to the UPS, and then 
> another several seconds for the UPS to actually shut down. What I found
> disturbing is that after issuing the shutdown command, the driver never
> returns. I kind of expected that it would, so you can resume the rest of
> the shutdown.
> 
> I assume NUT is written for Linux first and foremost, because the
> examples given for the shutdown script do not work with FreeBSD.
> Running the shutdown command in the background and then sleeping for 2
> seconds works for me.

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?mm1ymmqq2u.ymm>