Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # wait for power loss
- while sleep .5 ; do
- apcaccess |grep -q '^STATUS.*ONLINE' || break
- done
- # set current time to zero
- date=$(date +%s)
- while sleep .5 ; do
- pct=$(apcaccess |awk -F' +|\\.' '/^BCHARGE/{print$3}')
- # if capacity is changed print it
- if [ "$pct" != "$last" ]; then
- echo $(($(date +%s)-date))
- echo "Batt: $pct %"
- last=$pct
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement