1

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.

0

2 Answers 2

1

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
  • Move into your local bin, if it's included in your shell path. The file currently resides in your top user directory ~/

$ mv cycle ~/bin/

0
2

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}'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .