Linux - Laptop and NetbookHaving a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273
Rep:
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.
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.
Last edited by David the H.; 10-06-2008 at 08:10 AM.
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273
Original Poster
Rep:
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.
Distribution: Fedora mainly, but I am open to others.
Posts: 273
Rep:
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.
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273
Original Poster
Rep:
You absolutely right, your majesty!
Here's my script:
Code:
#!/bin/bash
#Start with minimum processes on battery power
if grep -q off-line /proc/acpi/ac_adapter/ACAD/state
then
#Here come the programmes you wish to start after login (on battery power)
#For example:
gnome-power-manager
#If they are in your $PATH you can just give their binary names, otherwise you have to write the full paths to the applications
elif grep -q on-line /proc/acpi/ac_adapter/ACAD/state
then
#Here come the programmes you wish to start after login (on AC power)
#Examples:
gnome-power-manager
nm-applet --sm-disable &
restricted-manager --check &
trackerd &
update-notifier &
gnome-volume-manager --sm-disable &
#etc.
fi
Go to System > Preferences > Sessions and add it to your startup programmes (first tab). If you always login in English (or some other languague that actually never changes), then you can deselect/remove "User folders update", which is only useful when you change languages and would like your folders to have localized names. If you don't use magnifiers and the like, you can rest assured when you deselect/remove "Visual". This might help the startup process to be slightly quicker.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.