You are not logged in.

#1 2012-08-25 20:01:35

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Runing script of power state change

I have two scripts I want to be run on power state change - one when to battery power and the other when connecting AC.

The information of AC state is here: /sys/class/power_supply/AC/online, and the values are 0 or 1.

So I wrote a script that looks like that

if grep -Fxq "0" /sys/class/power_supply/AC/online; then
    powerdown
else
    powerup
fi

and added it to be run from /etc/rc.local

But it does not seem to run on power source change.

What's wrong?

Last edited by Lockheed (2012-08-25 20:10:40)

Offline

#2 2012-08-25 20:05:37

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Runing script of power state change

Offline

#3 2012-08-25 20:10:59

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: Runing script of power state change

I forgot to mention this is on a setup without PM-utils.

Offline

Board footer

Powered by FluxBB