SlackwareThis Forum is for the discussion of Slackware Linux.
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.
Is there any way to get Slackware to automagically run a script that changes the scaling_governor from ondemand or performance to powersave once the system runs on batteries, and then back to ondemand or performance when it's plugged in again?
I'm currently running echo -n ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor on boot, but I haven't found any hooks anywhere under ACPI to run a similar (except powersave) when the system is unplugged..
Well if I am not mistaken you can see if the laptop is plugged in or not in /proc/acpi. Write a script to just parse the right file every what, 1 minute, maybe 30 seconds. Then if it shows it's not plugged in it changes the schema. Simple enough.
That's one way of doing it, but being a purist I'm not a big fan of scripts that poll a file every n seconds, so what I was hoping for is that there's a hook somewhere that runs a script when I unplug power.
There is a directory called /etc/acpi that contains some default actions and a handler-script, but all documentation I've found so far relate to putting the system into hibernate/sleep, and not just changing runlevel when unpowering the system.
Not sure what the 'purist' reference is, but to me whatever works is best. To each his own I suppose. Scripts are just an easy way to do tasks. You can do that in >30 lines of bash scripting, but eh.
You could use something like cpufreqd to automatically change the governor when on batteries (laptop-mode-tools also has some basic support for changing cpu frequency governor).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.