Skip to content

Instantly share code, notes, and snippets.

@brb

brb/battery.sh

Created Jun 3, 2017
Embed
What would you like to do?
battery.sh
#!/bin/sh
# * * * * * battery.sh /home/brb/Dropbox/battery-stats.txt
set -eu
for b in /sys/class/power_supply/BAT*; do
echo "$(basename "$b") $(date +%s) $(cat ${b}/power_now) $(cat ${b}/energy_now)" >> $1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment