Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 3375  / 3 Years ago, fri, september 10, 2021, 6:12:38

So, I wan't to run it when start work on AC and this or better other script when start work from battery



I tried




  • /etc/acpi/power.sh

  • adding symlink to /etc/laptop-mode/battery-start



It seems to not working


More From » 11.04

 Answers
7

You should be able to do what you want with a script in /etc/pm/power.d. Quoting from the HOWTO.hooks file in pm-utils:




How to write a pm-utils hook:



PARAMETERS



A pm-utils hook is simply an executable file that accepts at least one
parameter.



For hooks in power.d, the potential values of that parameter are:




  • true -- the hook MUST perform whatever action is appropriate when the system
    transitions TO battery power.

  • false -- The hook MUST perform whatever action is appropriate when the system
    transitions FROM battery power.




You might also want to read some of the existing power hooks in /usr/lib/pm-utils/power.d for ideas about how to structure your script.



Note that if you use the pm-utils interface, you'll be told whether you're on AC power or not through the first argument: if $1 is true, then you're switching to battery power, and if it is false then you're switching back to mains power.


[#43972] Saturday, September 11, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ickump

Total Points: 234
Total Questions: 124
Total Answers: 111

Location: Jordan
Member since Fri, Apr 8, 2022
2 Years ago
;