From owner-freebsd-hackers Fri May 19 11:20:28 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.cdrom.com (adsl-63-206-88-224.dsl.snfc21.pacbell.net [63.206.88.224]) by hub.freebsd.org (Postfix) with ESMTP id 24A9F37B532 for ; Fri, 19 May 2000 11:20:24 -0700 (PDT) (envelope-from msmith@mass.cdrom.com) Received: from mass.cdrom.com (localhost [127.0.0.1]) by mass.cdrom.com (8.9.3/8.9.3) with ESMTP id LAA09144; Fri, 19 May 2000 11:21:16 -0700 (PDT) (envelope-from msmith@mass.cdrom.com) Message-Id: <200005191821.LAA09144@mass.cdrom.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Cillian Sharkey Cc: Doug White , hackers@freebsd.org Subject: Re: Post-shutdown hook for UPS shutdown? In-reply-to: Your message of "Fri, 19 May 2000 18:05:25 BST." <20000519180525.A29385@psn.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 19 May 2000 11:21:15 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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