Battery capacity logger


Forum: Laptops
Topic: Battery capacity logger
started by: thenuke

Posted by thenuke on Nov. 15 2004,06:01
I was exploring through the fascinating filesystem of Linux and then I found /proc/acpi/battery/MBAT/
There can be found current battery capacity among other stuff in a text file named state.

So I thought about learning a bit of scripting and now I have a crontab running a script which logs current battery capacity every minute with clock time.

Grab it from there if you wish to:
< http://cygserv.cygnnet.jkl.fi/thenuke/batlog >

If you happen to ask what could be done with this.
I'm going to try to draw some graphs with some spreadsheet software outta the data I gather.

"Crontab is a program that allows users to create jobs that will run at a given time."

Crontab is not installed on DSL by default, I used apt-get install cron to get that.
Because I do not like vi-editor I command EDITOR=nano followed by crontab -e which then opens my favourite editor nano.
On the first empty line I write * * * * * /home/thenuke/batlog
That then runs batlog-script every minute. Check man crontab for more info on that if you wish.

p.s. This was like my first linux script and contribution to these forums, I am sure that one could do the same with one line of code but I'm not the one yet ;-)

join the irc.freenode.net & #damnsmalllinux

Posted by ico2 on Nov. 24 2004,17:18
mmmmmmmmmmm, you don't mind if i steal your idea and try to make a nice graphical battery monitor do you?
Posted by AwPhuch on Nov. 24 2004,21:17
I thought crontab was there by default in /etc/crontab

Brian
AwPhuch

Posted by caulktel on Nov. 24 2004,21:19
I can't seem to grab it from the above link.
Posted by Toasted Pentiums on Nov. 24 2004,21:44
I'm running 0.8.3, and there is a similar file in /proc/apm.
And I cannot access the site to download the script either, so could you post the code in this thread?

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.