apmd question

dattaway at attaway.net dattaway at attaway.net
Fri Jun 28 17:18:27 CDT 2002


On Fri, 28 Jun 2002, Becker, Rob wrote:

> I would like to have a laptop shut itself down 10 minutes after it
> switches from ac power to battery.  I have RH 7.3 on the laptop and apmd
> is installed and running.  I can query apmd to get the amount of time
> left on the battery and it will warn me and put the laptop into standby
> when the battery gets down to a few minutes left.  I also want it to
> shut itself off when the battery gets too low instead of going into
> standby.  This is a laptop that I am using to play ogg vorbis files in
> my car.  I've read the man pages on apm and apmd as well as poked around
> the config files in etc/sysconfig/apm (that's an approximation of the
> directory as I'm not near the machine now to verify it exactly) and
> haven't found what I need to make this work.  I'm thinking of having the
> apm daemon just call shutdown with a 10 minute timeline when it notices
> that it's on battery.  Has anyone done something like this before?  Any
> tips, warnings, etc?  All ideas appreciated. Thanks. Rob

apmd is your friend.  It can be started through the usual system boot
startup scripts, or you can start it manually.  Here are a few options it
has from its man page:

       -b ac_offline_cmd, --ac_offline ac_offline_cmd
              Provides a command to be run when  the  machine  is
              operating  on  battery  power,  though not when the
              daemon first starts.

       -l low_battery_cmd, --low_battery low_battery_cmd
              Provides a command to be  run  when  the  APM  BIOS
              judges that battery power is "low".

You can give it the shutdown command (with a time delay, if wanted) when 
either of these events occur.  Also, if you just want ten minutes after 
the plug has been pulled, you can use the -b option with the ten minute 
delay and set the -a "ac-online" command to cancel the shutdown.

-=Duane




More information about the Kclug mailing list