I would like to have a bash script to be executed when I switch to battery alimentation, is this possible?
Asked
Active
Viewed 549 times
2
-
Do you mean when the battery is used or the battery falls to a particular energy level? Good primer on battery levels here http://askubuntu.com/questions/69556/how-to-check-battery-status-using-terminal – Meer Borg Aug 24 '13 at 15:04
-
when it is used – Matteo Pagliazzi Aug 24 '13 at 15:08
1 Answers
1
yes there is a way.
From the Advanced Power Management (APM) daemon (apmd) man-page . This is a program. so when you remove the battery automatically this program will run. so you can use a condition to check the status of this program. If condition done then you can run the script else you can wait until it will runs.
change power
Invoked when the APM subsystem reports a change in power status,
such as a switch from mains to battery power.

Raja G
- 102,391
- 106
- 255
- 328
-
-
-
check it once , because conflict will happen if acpi and apmd doing the same process/job. but as I know acpi not having any functionality like change power.so there will be no conflict. – Raja G Aug 24 '13 at 15:15
-