Re: battery life

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Thu, Sep 28, 2023 at 10:56:42AM -0400, Matt Morgan wrote:
> 
> IIRC powertop shows the current status of things.

- start powertop as root
- use the TAB key/shift+TAB key to move to tab "Tunables" and/or "Wakeup"
- use the cursor and enter key to switch the settings

cause the above setting will get lost after reboot I wrote script to generate a rc.local.
the rc.local should be owned by root: 

sudo chown root:root rc.local 

and should have the rights 700 (needed: ?, I'm unsure, but it works with it):

sudo chmod 700 rc.local

the rc.local should be moved to "/etc/rc.d/" and the box should be rebooted afterwards.
a "systemctl status rc-local.service" will then show the status or if the power setting are applied.

double check: sudo powertop and via TAB key to "Tunables": all should read "Good" 

BE AWARE:
mouse and keyboard might get stuttering, cause in power safe mode
if so: comment out the power settings in the rc.local for both devices !
- the script excludes Logitech devices (Logitech mouse+keyboard) here -

the following script creates a file called "rc.local_<date-of-script-run>" 
and must be renamed to rc.local
====
#!/bin/bash

clear;

[ ${EUID} -gt "0" ] && echo -e "\n login as ROOT ! \n" && exit 13;

My_RC_LOCAL=rc.local_$(date +%F);

# clean up
   [ -e ${My_RC_LOCAL} ] && rm -rf ./${My_RC_LOCAL};


# build rc.local
   echo -e "\n generating NEW rc.local...\n";


cat << _EOF_ > ${My_RC_LOCAL}
#!/bin/bash
touch /var/lock/subsys/local

# created: 2023-09-28
#

_EOF_


   echo -e " running Powertop, wait ...\n";
   powertop --csv=tmp_$$;

   # 1. search relevant lines
#    sed -i '/Runtime\|Autosuspend/!d' tmp_$$;
    sed -i '/echo/!d' tmp_$$;


   # 2. treat comment sign at the line beginning
   sed -i -e 's/^/# /g' tmp_$$;


   # 3. exclude mouse, keyboard:
   # ...]; => ...];#
   sed -i -e '/Logitech/s/];/];###    /g' tmp_$$;
   sed -i -e '/Keyboard/s/];/];###    /g' tmp_$$;


   # 4. split at ";", and insert empty lines
   cat tmp_$$ | tr ';' '\n' >> ${My_RC_LOCAL};


   # for lines with "echo" at the beginning add a semicolon at the end
   sed -i -e '/echo/s/$/;/g' ${My_RC_LOCAL};

   # mark excluded devices
   sed -i -e '/Logitech/s/^# /###     /g' ${My_RC_LOCAL};
   sed -i -e '/Keyboard/s/^# /###     /g' ${My_RC_LOCAL};


   echo -e "\n\nexit 0;"  >> ${My_RC_LOCAL};

   chown root.root ${My_RC_LOCAL};
   chmod 700 ${My_RC_LOCAL};

   [ -e tmp_$$ ] && rm -rf ./tmp_$$;


   echo -e "\n+++ new ${My_RC_LOCAL} looks like this, press Enter +++ \n" && read;

more ${My_RC_LOCAL};

exit 0;

====

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux