Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 May 2000 11:21:15 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Cillian Sharkey <cns@psn.ie>
Cc:        Doug White <dwhite@resnet.uoregon.edu>, hackers@freebsd.org
Subject:   Re: Post-shutdown hook for UPS shutdown? 
Message-ID:  <200005191821.LAA09144@mass.cdrom.com>
In-Reply-To: Your message of "Fri, 19 May 2000 18:05:25 BST." <20000519180525.A29385@psn.ie> 

next in thread | previous in thread | raw e-mail | index | archive | help
> On 19 May 2000, Doug White wrote:
> > On Fri, 19 May 2000, Cillian Sharkey wrote:
> > > I need to execute a script (which tells the UPS to turn off) *after* the
> > > system has come to a safe halt from shutdown -h. I can't place the commands
> > > in /etc/rc.shutdown because this is too early in the shutdown sequence.
> > 
> > To do anything that late you'd have to hack the kernel.
> 
> Hmm, thought so. However if all filesystems are unmounted after disks are
> synced, wouldn't that make the software (kept in /usr/local) un-available..?
> 
> > I believe APC's units have a 'time-delay shutdown' line that you can
> > throw as late as possible and it'll give you 10 seconds to get all the way
> > down.  I'm not sure about the BackUPSs tho.
> 
> That's right - BackUPSs don't have the feature; they shutdown the moment
> they get the signal.
> 
> > The other option is to not bother turning off the UPS; you're safe one
> > you're halted.  That or try turning the machine itself off if apm and
> > shutdown -p can do it.
> 
> I considered this, but we need unattended shutdown when power goes / reboot
> when power comes back. If the power cut was long enough, the UPS battery
> would soon cut out and the machines would bootup correctly when the power
> comes back, however this doesn't work if the power comes on before the
> battery has fully discharged..

The canonical way to do this is actually to shudown and reboot.

In the _startup_ phase, while the root filesystem is still mounted 
readonly, you check the UPS status.  At this point, you have access to 
the disk in a read-only fashion, and you can power-off (or have the UPS 
die) at any time.

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  msmith@freebsd.org
\\ and he'll hate you for a lifetime.             \\  msmith@cdrom.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005191821.LAA09144>