[CentOS] 2 questions re UPS management

Tue Mar 19 16:44:37 UTC 2013
Fred Smith <fredex at fcshome.stoneham.ma.us>

On Tue, Mar 19, 2013 at 11:10:07AM -0400, m.roth at 5-cent.us wrote:
> Fred Smith wrote:
> > Hi, trying to figure out how the system manages UPS connections. On both
> > Centos 5.9 and 6.4, merely plugging in a USB UPS device causes an icon
> > to appear in the top panel, and (at least on 5.9, haven't yet tested
> > this in 6.4) when the UPS suffers a power failure the system notices
> > and after a bit does a clean shutdown.
> 
> Interesting.... I haven't observed this behavior; certainly not on
> headless servers, though most are on UPSes; nor, when I had a working UPS
> for my workstation, have I seen it. Are you running gnome or KDE?
> >
> > All this without installing ANYTHING extra.
> >
> You mean, like apcupsd?

Yes, nor "nut" either.

> 
> > question #1:
> > in 5.9 there are two entries in /etc/inittab, one for power fail and
> > the other for power restoration. The default setting for the powerfail
> > entry has it doing a shutdown in 2 minutes.
> <snip>
> > message (when power fails) about the line being too long. So, I created
> > a shellscript that runs both the command to tell XP to go down, followed
> <snip>
> > 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.
> 
> Thinking about this as I write, I'd guess that it expects the machine
> *receiving* the shutdown to respect the five minute wait. What you might
> want to do is a sleep 300 before sending the command.
> <snip>

just to be sure I'm clear: the shutdown command appears to be sent
to windows, as I desire. then instead of honoring the "+5" in the 
local shutdown command it shuts down immediately.

but if I just run the identical script from a commandline it does
exactly what I think it should: (1) tells windows to shut down then (2)
waits 5 mins before shutting down Linux.

-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
  "For him who is able to keep you from falling and to present you before his 
 glorious presence without fault and with great joy--to the only God our Savior
 be glory, majesty, power and authority, through Jesus Christ our Lord, before
                     all ages, now and forevermore! Amen."
----------------------------- Jude 1:24,25 (niv) -----------------------------