[CentOS] 2 questions re UPS management
Fred Smith
fredex at fcshome.stoneham.ma.us
Wed Mar 20 04:09:49 UTC 2013
On Tue, Mar 19, 2013 at 03:36:45PM -0700, Gordon Messmer wrote:
> On 03/19/2013 07:55 AM, Fred Smith wrote:
> > All this without installing ANYTHING extra.
>
> GNOME features power management software that handles common battery
> support. The same software manages laptops that operate on battery and
> desktop PCs with a UPS.
>
> > When I run this script from the commandline it works just fine. but when
> > I turn off input power to the UPS it starts the XP shutdown then within
> > without waiting the specified length of time, initiates the shutdown
> > of Linux. Once the shutdown is done, the UPS powers off, thereby killing
> > the not-yet-shutdown windoze box.
>
> If you run the script manually, you should expect to see the Windows PC
> shut down, then the Linux machine after 5 minutes, and the UPS should
> shut down with the Linux host. Is that what happens?
Yes. exactly that.
And, if I use the original inittab entry (which is just the shutdown
command for linux, with a "+3" in it) it waits 3 minutes then shuts
down.
> It sounds like you have the Linux host on the UPS "master" port, which
> typically has to be configured specifically to behave the way that you
> describe. One option that you might have is to configure the UPS not to
> turn off along with the master port, particularly if you have more than
> one PC on it. Master ports should only be used if the UPS is powering a
> single PC and its peripherals (external disks, etc).
I dunno what a "master port" is,... there's only one place to connect
the USB cable to the UPS.
>
> If you're not using a master port, then it sounds like the UPS is simply
> draining too quickly. If you have a 500Va UPS, it's probably not going
> to support two PCs for five minutes. Without knowing more about the UPS
> capacity and its load, we can only speculate, but it may be that GNOME
> is firing off the system shutdown script on power loss, then firing
> another shutdown when the available power reaches a critically low
> threshold, and then everything shutting off when there's no longer juice
> to support it (especially if you're testing this without giving the UPS
> 24 hours to fully charge up).
No, it's a 1500VA (900 W) ups. it powers two PCs, one monitor and one
teeny little network switch. normal load is between 190-200 watts.
It's got plenty of oomph to power both systems for at least 15 minutes.
> Try turning off the Windows host and then pulling the UPS off of line
> power. See how everything behaves when only the Linux host is running
> on the UPS.
>
> > The shellscript does contain "#!/bin/sh" as its first line, but it is
> > currently being invoked simply by the path to the script. when I get
> > back to the office I'll try changing it to "/bin/bash /etc/powerfail"
> > to see if that makes a difference, but I kinda don't expect it to.
>
> It won't.
>
> > So, I'm wondering how the underlying mechanism works, AND if anyone knows
> > how (or even IF) it's possible to hand inittab a script to run instead of
> > burying the necessary commands directly into the inittab entry.
>
> Yes, I believe you're doing it correctly.
so my puzzle remains: why does shutdown not honor the "+5" when it's
part of a separate script, but does when it's not?
>
> If you want the systems to shut down whether or not you're logged in,
> you'd need to install NUT and configure it to manage the UPS, and
> configure GNOME to not do so.
You think this mechanism only works when logged in? (I have no idea,
I'm not doubting you, it's simply a thought I hadn't had--yet).
but that's probably not a problem, I'm logged in there pretty much
24 hours a day.
> > Question #2:
> > On the Centos 6.4 box at home, I haven't yet tried turning off power to
> > the UPS to see if it actually shuts doown, but given that a UPS icon
> > appears in the panel, and there are settings for what should happen
> > when power fails, I expect it will.
>
> If you're logged in, yes. If you're not logged in, nothing is
> monitoring the UPS.
>
> > The question here is: how does this magic all work?
>
> GNOME! It "just works"!
>
> > We no longer have
> > any entries in inittab to manage this, apparently we now use upstart
> > to manage the same things, and I've spent some time digging for man
> > pages and looking around for upstart file(s) to find out how such
> > events are handled, and so far I've not found anything specifically
> > for a "powerfail" event.
>
> Yeah, if you want a system that you have more control over, use NUT
> rather than GNOME. You'll gain the added benefit of UPS support when no
> user is logged in at the console.
the C6 system is a personal desktop, at home, and it too is logged in
most of the time. Last time I looked at nut, I found too many things
I had to know in order to configure it that I didn't know, like it wasn't
clear which nut device driver was correct for the tripplite UPS I had
at the time, and some of the configurations (as far as I recall,... it's
been several years) depended on which device it was. So after messing
with it a while, and it not working, I just gave it up.
Thanks for the info, though.
Fred
--
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
The Lord detests the way of the wicked
but he loves those who pursue righteousness.
----------------------------- Proverbs 15:9 (niv) -----------------------------
More information about the CentOS
mailing list