Ubuntu – Does pm-powersave start automatically when running on battery

laptoppower-management

So I just learned a bit more about pm-powersave, but couldn't find if it automatically kicks in if you're running battery power. Does somebody know if it does this? And if not, is there a way to make pm-powersave automatically activate once I am running on battery?

Best Answer

It does not run on my system when I plug and unplug my power adapter. You can check whether it is run or not by looking at /var/log/pm-powersave.log. Type tail -f /var/log/pm-powersave.log and then plug/unplug your power adapter, it will shows what scripts are run and their output. If you got nothing, then it means nothing is run.

You can create a new udev rules file to make scripts in /usr/lib/pm-utils/power.d/ and /etc/pm/power.d run. As root, create /etc/udev/rules.d/99-powersave.rules, and put the following content into this file:

SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/sbin/pm-powersave true"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/sbin/pm-powersave false"

Now try to put your system into battery mode and you should be able to see output in /var/log/pm-powersave.log, which means the scripts have been executed.