Stop processes when on battery to save power
Hi!
Does anyone know if it is possible to stop certain processes from being loaded (by a short start-up script) when one boots the laptop? I have several processes that should be loaded when starting with my laptop plugged in, but when I am working on my battery I don't want them to start (e.g. trackerd, network manager, update notifier, etc.), since they slow my laptop down or are not needed, as I don't have internet access. Any help appreciated! |
You should be able to use ivman. It uses hal to detect changes in the system, such as when the device is on battery power, and will run whatever command or script you want on selected events. Not just for start-up, but for any change in status, so you can have it start and stop processes any time you switch power supplies.
|
I have solved it rather easily by creating a startup script that checks whether the battery or the AC power is used (with grep) and depending on that outcome loads the minimal processes or all, respectively. I then added that script to the start up (preferences>sessions) and deselected the previously selected items (as they are now incorporated in the script).
It does not work with the HAL daemon and does not reactive or deactivate while running if one plugs or pulls out the power cable, but it works for me. I would be interested to know how to do it with the lvman method, just for good order. |
If you have an Intel based laptop, there is a program called Powertop and when run from a terminal, it will tell you which processes are using the most power.
|
unihiekka, being said that you fixed youre own problem. Would you please Post you're script. for if some one else has a Similar issue, they may use you're solution.
|
You absolutely right, your majesty! :D
Here's my script: Code:
#!/bin/bash Actually, for this script to be useful, you have to deselect all startup programmes and add their respective binary names to the script. You can find those names if you click on the items in the list and then click on edit. Just copy-paste the "command" to the correct section of the script (with battery or AC powered). I have added gnome-power-manager to both parts, since I want to know how much battery time there is left (on battery) or how much longer it will take to fully charge my battery (on AC). But you are free to edit the script as much as you like. Just make sure that it is the only selected item in the Sessions list (the others don't have to be removed, merely deselected) and that all programmes that you wish to start are in the script [if this script is selected and the ones that the script should start, then the script restarts these programmes, which in itself is not terrible, but slow and not wise, because the intention of my script is to remove unnecessary programmes at startup]. Then it should do what you hope it to do. I hope that helps! |
thank you for taking the time to share youre solutions with us. im sure it will help some one very much!
|
yea this thing is very nice, i might even use it when i have classes and no way to plug in the power cord. thanks a lot
Debian Development |
All times are GMT -5. The time now is 11:56 PM. |