I’ve always used
laptop-mode-tools on Ubuntu to enance the power consumption on my laptop. It worked fairly well but one thing it didn’t do too wel is handling suspend/resume. After a resume laptop-mode-tools was often confused in which state the laptop was (on ac / on battery). I tried to tweak the behavior but I couldn’t really get it working reliably
Thats’s why I decided to try out tlp (Thinkpad Laptop Power?). Different to the name suggests, it’s not only useable on Thinkpad’s but on every kind of laptop.
One disadvantage is that you have to install a PPA to get the tlp packages. After this minor action I did a
apt-get install tlp and started configuring it. It was quick confgured (even quicker then laptop-mode-tools) and after a suspend it seemed tlp was smarter about that then laptop-mode-tools.
Disabling services based on ac/battery power was a feature of laptop-mode-tools but not of tlp. Hower, pm-utils (power.d) supported this feature so that was also quickly fixed.
In a quick overview this is how I got the enabling/disabling of services on ac/battery working with pm-utils:
- install this helper script to
Done! If you’re familiar with ansible you can check a role I wrote for tlp: https://github.com/LeonB/ansible-tlp
If anyone has any questions: please let behind a comment.