From owner-freebsd-questions@FreeBSD.ORG Sat Apr 24 12:38:09 2004 Return-Path: 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 660CE16A4CE for ; Sat, 24 Apr 2004 12:38:09 -0700 (PDT) Received: from m01.ca.astound.net (m01.ca.astound.net [64.85.239.11]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4836243D39 for ; Sat, 24 Apr 2004 12:38:09 -0700 (PDT) (envelope-from rchopra@cal.berkeley.edu) Received: from cal.berkeley.edu (astound-64-85-251-8.ca.astound.net [64.85.251.8]) by m01.ca.astound.net (8.12.10/8.12.10) with ESMTP id i3OJbYhT019622 for ; Sat, 24 Apr 2004 12:37:34 -0700 Message-ID: <408AC21F.7030306@cal.berkeley.edu> Date: Sat, 24 Apr 2004 12:38:07 -0700 From: Rishi Chopra User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: questions@freebsd.org References: <40856E4C.7020300@cal.berkeley.edu> In-Reply-To: <40856E4C.7020300@cal.berkeley.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new Subject: Re: apcupsd and 'shutdown -p' X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2004 19:38:09 -0000 Rishi Chopra wrote: > I'd like apcupsd to call 'shutdown -p' when halting the system. > Currently the daemon works OK but allows for a race condition (e.g. > battery is not dead but power is restored, leaving the system waiting > for a key to be pressed)... > > Anyone have any ideas on how to accomplish this? > Problem has been solved. Command can be aliased through shell variable manipulation -or- as Neil Darlow suggested on the apcupsd mailing list ([apcupsd-users] apcupsd and 'shutdown -p', 4/23/2004, 1:20AM): Just change the shutdown command in the doshutdown case within apccontrol to the following: doshutdown) echo "UPS ${2} initiated Shutdown Sequence" | wall ${SHUTDOWN} -p now "apcupsd UPS ${2} initiated shutdown" ;; Note: this will require APM or ACPI to be enabled in your BIOS and system configuration (i.e. run apmd at startup for APM or enable ACPI in your kernel). ACPI is still experimental, your mileage may vary. NOTE: files referenced located in /usr/local/etc/apcupsd -- Rishi Chopra http://www.ocf.berkeley.edu/~rchopra