I'm just curious if anyone knows where I can find the files that feed the data into the System Information Application (ATA, Audio, etc).
I am interested in writing a program that sends an email every time the battery cycle count increases.
Thanks.
I'm just curious if anyone knows where I can find the files that feed the data into the System Information Application (ATA, Audio, etc).
I am interested in writing a program that sends an email every time the battery cycle count increases.
Thanks.
I don't know the file per-say, but you can use a simple shell script to get the battery cycle count, as seen here.
system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'
System Information is a GUI for the CLI system_profiler. It's read directly from whatever system_profiler spits out. All the work is already done for you (system_profiler reads from many different files and executables):
!Just saw an answer posted. See @XAleXOwnZX for the exact command.
To compile that into a script within Terminal, enter text as follows. Return is supported for newlines after cat command.
$ cat > cycle
#! /bin/bash
#Output is current cycle count of the battery
system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'
^D
Now, you have the script. Press Control+D within terminal for a carriage return:
Make executable with chmod +x cycle
Test:
t$ ./cycle
4
$ mv cycle ~/bin/