Created
January 5, 2020 12:44
-
-
Save jmtsantos/1c7691fcc24ba70e17fd92dd33a674ec to your computer and use it in GitHub Desktop.
Register battery life to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
start_time="$(date -u +%s.%N)" | |
while true | |
do | |
elapsed_time="$(date -u +%s.%N)" | |
echo "battery:$(cat /sys/class/power_supply/BAT1/capacity) seconds:$(bc <<<"($elapsed_time - $start_time)/60") uptime:$(uptime)" | |
echo "battery:$(cat /sys/class/power_supply/BAT1/capacity) seconds:$(bc <<<"($elapsed_time - $start_time)/60") uptime:$(uptime)" > uptime.txt | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment