acpiexec - Run programs if on battery and/or ac power

Nate Lawson nate at root.org
Thu Jul 1 15:32:06 PDT 2004


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


More information about the freebsd-mobile mailing list