using custom powersaving script

Hi,

I would like to run a few commands when my laptop is using battery power. I managed to write an ACPI script which is duly executed by acpid every time the AC adapter is connected/disconnected, but for some reason, my values are overwritten by something else.
Same happened before when I was setting the values as default using an init script, the settings were correct until I plugged out the ac adapter or plugged it in. Every time I did that, the values reset to default.

Can someone please hint me in the right direction to as what application might be overwriting my values on ac adapter events? No other ACPI script seems to touch anything of those values.

These are the commands I’m trying to run, and AT LEAST the /proc/sys/vm entries are overwritten by something else to default (500 and 0) every time an ac adapter event occurs.
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 5 > /proc/sys/vm/laptop_mode
echo 7 > /sys/bus/pci/drivers/iwl3945/0000:03:00.0/power_level
/usr/bin/hal-disable-polling --device /dev/scd0
echo “disable” > /proc/acpi/ibm/bluetooth
/sbin/hdparm -q -S 60 /dev/sda

Help would be very much appreciated,
Sincerely,

Alex

If you’re on KDE, then it’s kpowersave: if you right-click on its icon in system tray and configure it, you’ll see there’s a default power saving scheme for “AC” and a default power scheme for “battery”. They get invoked automatically each time you plug or unplug the power cord. You may be able to disable that or, alternatively, disable kpowersave altogether.

Thanks for your answer, but I’m using GNOME, and I can’t seem to find any settings in the gnome power manager about that.
Any further ideas?

Nevermind,I just installed laptop_mode-tools which does pretty much everything I need and even more.
The version shipping with openSUSE 11.1 is a bit outdated and hasn’t as many “plugins” as the new version on the official page, so anyone who reads this might want to check out the official page.

Sincerely,
Alex

Sorry to bring up an old thread, but I read on the Thinkwiki site that if we are using Suse then it’s not recommended to use laptop tools as powersaved already takes care of it.

Any comments? I’d like to refine my power management but not sure what to do.