From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 15 16:37:59 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 264321065679 for ; Sun, 15 Jun 2008 16:37:59 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id A6E108FC20 for ; Sun, 15 Jun 2008 16:37:58 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-25-183.bredband.comhem.se ([83.253.25.183]:56837 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1K7v0F-0001Ch-3Y for freebsd-hackers@freebsd.org; Sun, 15 Jun 2008 18:22:53 +0200 Received: (qmail 17314 invoked from network); 15 Jun 2008 18:22:47 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 15 Jun 2008 18:22:47 +0200 Received: (qmail 24451 invoked by uid 1001); 15 Jun 2008 18:22:47 +0200 Date: Sun, 15 Jun 2008 18:22:47 +0200 From: Erik Trulsson To: Lev Serebryakov Message-ID: <20080615162247.GA50613@owl.midgard.homeip.net> References: <1283529703.20080615190810@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1283529703.20080615190810@serebryakov.spb.ru> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-IP: 83.253.25.183 X-Scan-Result: No virus found in message 1K7v0F-0001Ch-3Y. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1K7v0F-0001Ch-3Y 802ab95020de2b38a5cb612fb8623e74 Cc: freebsd-hackers@freebsd.org, mtm@freebsd.org Subject: Re: UPS shutdown with `sysutils/nut': where should I place "power off" command to UPS? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jun 2008 16:37:59 -0000 On Sun, Jun 15, 2008 at 07:08:10PM +0400, Lev Serebryakov wrote: > Hello, freebsd-hackers. > > nut's documentation says[1], that UPS should be switched off from > shutdown scripts in point, when FSes are synced and re-mounted as R/O. Problem is, on FreeBSD the FSes are not re-mounted as R/O during shutdown. > > google shows thread[2], according to which, last line of > `/etc/rc.shutdown' is too early, and if power will be switched off at > this line, FSes will be dirty on boot. Correct. > > What is proper place for "power off" command on FreeBSD system? There isn't any. On FreeBSD the filesystems are synced and marked as clean by the kernel, *after* all the shutdown scripts have finished. (Unlike Linux where the shutdown scripts are responsible for syncing and umounting/re-mounting the file systems.) > > Please, note, that it is NOT `shutdown -p', but signal to UPS to > switch off EXTERNAL power when battarey is almost dead, and no > external power, and `shutdown -p' turns off only computer, not UPS. You need an UPS that can accept a signal that says 'shut down in 20 seconds time' (the value 20 may have to be adjusted) and send that as the last thing in the shutdown scripts, which should cause the UPS to shutdown shortly after 'shutdown -p' has turned off the computer. > > > [1] http://www.networkupstools.org/doc/2.2.0/shutdown.html > [2] http://lists.freebsd.org/pipermail/freebsd-questions/2006-May/122764.htm > -- Erik Trulsson ertr1013@student.uu.se