Ask / Submit
1

Is there any way to check charge status from the terminal?

asked 2014-04-22 14:32:48 +0200

icebox gravatar image

updated 2014-08-27 11:14:38 +0200

jiit gravatar image

Hi,

I'm using a script on my NAS to rdiff-backup my phone when it's in the home network. I would like to tune this script to only start if the phone has at least say 80% charge. Is there any way to check the charge level from the terminal?

Thanks

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
5

answered 2014-04-22 15:01:20 +0200

qUAp gravatar image

Try to cat the modules in /sys/class/power_supply/battery, there you can get all the information you need about the battery.

edit flag offensive delete publish link more

Comments

Thanks for pointing me to the right direction. Specifically what I will use in my script are:

/sys/class/power_supply/battery/capacity - gives the charge percentage, no math required

/sys/class/power_supply/battery/status - charging / discharging

icebox ( 2014-04-22 15:05:19 +0200 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-04-22 14:32:48 +0200

Seen: 359 times

Last updated: Apr 22 '14