From owner-freebsd-mobile@FreeBSD.ORG Thu Jul 1 22:32:06 2004 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B80F16A4CE for ; Thu, 1 Jul 2004 22:32:06 +0000 (GMT) Received: from root.org (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id E36E743D46 for ; Thu, 1 Jul 2004 22:32:05 +0000 (GMT) (envelope-from nate@root.org) Received: (qmail 49176 invoked by uid 1000); 1 Jul 2004 22:30:24 -0000 Date: Thu, 1 Jul 2004 15:30:24 -0700 (PDT) From: Nate Lawson To: Drew Broadley In-Reply-To: <40E479CE.7060203@corrupt.co.nz> Message-ID: <20040701152848.G49159@root.org> References: <40E479CE.7060203@corrupt.co.nz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: acpi@freebsd.org cc: mobile@freebsd.org Subject: Re: acpiexec - Run programs if on battery and/or ac power X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 22:32:06 -0000 On Fri, 2 Jul 2004, Drew Broadley wrote: > I had a problem, whenever I was on battery I had cronjobs that were > running every 5 minutes for various things (my ifconfigd script, which > is like "whereami" for FreeBSD) and it sucked my battery down 3 times+ > faster. > > So here is the solution, I have made a Perl script ( and additional Perl > Module BSD::Sysctl for other uses including this script) where you exec > your current commands passed as an argument or option to acpiexec. By > default, acpiexec will run the command when on AC power but NOT on battery. Glad you're writing stuff but this sounds like it can be done fully in devd. Check out /etc/devd.conf and /etc/rc.d/power_profile and /etc/defaults/rc.conf to see how I use it to change Cx states on AC line transitions. We just enabled devd by default so hopefully more people will notice this capability. -Nate