apmd Command in Linux with Examples


This tutorial explains Linux “apmd” command, options and its usage with examples.

apmd – Advanced Power Management (APM) daemon.



apmd is an APM monitoring daemon, and works in conjunction with the APM BIOS driver in the OS kernel. It can execute a command (normally a shell script) when certain events are reported by the driver, and will log, via syslogd command, certain changes in system power status. When the available battery power becomes very low, it can alert all users on the system using several methods.

apmd [ -c check_seconds ] [ -P proxy_cmd ] [ -p percent_to_log ] [ -qVvW ] [ -w warn_percent ] [ -? ]

Options :

-c seconds, –check seconds
Controls how many seconds to block on the /dev/apm_bios device. Normally the daemon blocks until the APM driver reports an event; this number may be changed to cause battery charge or discharge rates to be checked more often.

-P proxy_cmd, –apmd_proxy proxy_cmd
Identifies the command to invoke when certain APM driver events are reported. See above for information about the arguments to this script.

-p percent_change, –percentage percent_change
Every time the percentage of available power changes (discharge or recharge) by percent_change, log information. The default is 5. Use values greater than 100 to disable this feature.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

-V, –version
Print the daemon’s version and exit.

-v, –verbose
Enables verbose mode, where each event reported by the APM driver is logged.

-W, –wall
In addition to logging low battery status (as determined either by the -w level or by the APM BIOS) using syslog, also use wall to alert all users. This is most useful if syslogd is not set up to write ALERT messages to all users. If both methods are used, more warnings will be made during the critical time period.

-w warn_percent, –warn warn_percent
When the battery is not being charged and the percentage of available power drops below warn_percent, log a warning at ALERT level to syslog. If the -W or –wall flag was given, the daemon will also use wall to alert all users of impending doom. Give the warning each time the percentage changes. The default is 10. Use negative values to disable this feature.


-q, –quiet
Disables the warnings identified by the -W and -w options. (The APM BIOS on many machines will provide an audible warning when power is about to be used up, so those extra warnings may not be needed.)

-?, –help
Prints a usage message and exits.

The important uses of this daemon includes the use of proxy commands to support power conservation activities. This command is specified using the -P option. It is invoked with one or two arguments:

Invoked when the daemon starts. Normally sets system-wide power policy, such as IDE hard drive standby times, to account for whether battery power is in use.

Invoked when the daemon stops. Normally undoes any policy settings done when the daemon started.


suspend [ system | user ]
Invoked when the APM driver reports that system suspension has been initiated. The second parameter indicates whether the BIOS or a user action (such as closing a laptop) initiated suspension.

The BIOS “suspend” mode aggressively conserves power, and normally involves shutting off power to all devices except the CPU core and memory, which is kept in a very low power mode. Most laptops can stay suspended, using battery power alone, for several days.

standby [ system | user ]
Invoked when the APM driver reports that system standby has been initiated. The second parameter indicates whether the BIOS or a user action (such as invoking apm -s) caused this.

The BIOS “standby” mode slightly conserves power, and leaves the machine able to respond almost immediately to user activity. Most laptops can’t stay in standby mode for even a day, if they must rely on battery power. Normally, nothing needs to be done beyond what the BIOS itself will do.

resume [ suspend | standby | critical ]
Invoked when the APM driver reports that system has resumed normal operation. The second parameter indicates what sort of mode it was in before, either the “suspend” mode (possibly a “critical” suspend) or else “standby” mode.


change power
This presents a subset of the APM driver “power change” events, specifically those where AC power was added or removed. This will often modify the system wide power policy; for example, so that IDE hard drives aggressively enter standby mode when only battery power is available.

change battery
The APM driver has reported that the BIOS thinks the strength of one (or more) batteries is “low”; at least ten minutes of power should remain.

change capability
Some change in the power management capabilities of the system was reported. It may have been caused by operation of some setup utility, or by the arrival or removal of some devices.

This daemon issues a number of different log messages, most of which should be self explanatory. The messages emitted for battery status need some explanation, however. The information logged contains 4 fields after a “Battery” or “Charge” label:

1) Rate of discharge (percent/minute). Negative rates indicate charging.
2) Time since total charge or total discharge (hh:mm:ss). This value is only useful if it reflects the time since a 100% or 0% state has been reached. Otherwise, this time is in parentheses, and reflects the time since the last “important” apmd status change such as starting the daemon, changing from AC power to battery power, and so on.
3) Estimate of time left until total discharge (or total charge), assuming use similar to that since the last resume ( or since AC was connected). This time is calculated by apmd itself.
4) Parenthetically, the percent and length of remaining battery life, as estimated by the APM BIOS (which is often a conservative estimate from an intelligent battery itself). This particular information is provided with most messages from this daemon.

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.