From owner-freebsd-questions Fri Sep 27 8:14:36 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF54937B401 for ; Fri, 27 Sep 2002 08:14:34 -0700 (PDT) Received: from server.rucus.ru.ac.za (server.rucus.ru.ac.za [146.231.115.1]) by mx1.FreeBSD.org (Postfix) with SMTP id 268F643E3B for ; Fri, 27 Sep 2002 08:14:29 -0700 (PDT) (envelope-from drs@rucus.ru.ac.za) Received: (qmail 41230 invoked from network); 27 Sep 2002 15:14:24 -0000 Received: from bashir.dsl.ru.ac.za (146.231.113.19) by server.rucus.ru.ac.za with SMTP; 27 Sep 2002 15:14:24 -0000 Received: (qmail 513 invoked by uid 1001); 27 Sep 2002 15:14:24 -0000 Date: Fri, 27 Sep 2002 17:14:24 +0200 From: David =?iso-8859-1?Q?Sieb=F6rger?= To: Petri Riihikallio Cc: questions@FreeBSD.ORG Subject: Re: How to shut down cleanly by killing power Message-ID: <20020927151424.GA430@rucus.ru.ac.za> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri 2002-09-27 (14:00), Petri Riihikallio wrote: > Have you thought about this situation: > > 1. The UPS is almost empty, and the monitoring system issues shutdown -p > 2. The system starts the shutdown sequence. It can take well over a > minute. There is no way to stop it now. > 3. Power returns before the UPS is completely empty. > > Now the system has shut down with the -p flag, but power is > continuously available. The system won't boot automatically, no > matter what you have set up in BIOS, because the power never was down. The way I've set it up, upsmon (part of NUT) issues a 'shutdown -p' when the battery is low. A local hack to rc.shutdown then instructs the UPS to turn itself off a few seconds later, by running: /usr/local/libexec/nut/newapc -a su1000 -k -d 3 In the scenario you describe, things would work like this: - mains power fails, and the UPS runs on battery power - eventually, the battery runs low - upsmon starts the shutdown process - rc.shutdown tells the UPS to turn itself off - the PC turns itself off - some seconds later, the UPS shuts down as instructed, without draining its battery - mains power is restored - the UPS notices that power is restored, powers up again, and the PC boots There is still a short period during which deadlock could occur (between the PC shutting down and the UPS shutting down), but this is far shorter than the time between the PC shutting down and UPS draining its battery. -- David Siebörger drs@rucus.ru.ac.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message