-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-battery-status.sh
37 lines (30 loc) · 1.03 KB
/
check-battery-status.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# check battery & AC status (Linux)
#
# * By Kordian W. <code [at] kordy.com>
#
# check that we have the right utils
which acpi >&/dev/null || {
echo "$0: no \`ACPI' utility installed!" >&2
exit 1
}
which upower >&/dev/null || {
echo "$0: no \`upower' utility installed!" >&2
exit 1
}
echo "* Battery ($(date "+%H:%M")):"
acpi -bi
upower -i $(upower -e | grep BAT) | egrep 'vendor|state|time to empty|energy-rate|energy-full|energy:|percentage|capacity|technology'
echo -e "\n* AC Power ($(date "+%H:%M")):"
acpi -ai
upower -i $(upower -e | grep AC) | egrep 'updated|online'
echo -e "\n* Misc ($(date "+%H:%M")):"
acpi -t
echo -en "\n* Available CPU Freq Power Schemes:\t\t"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
echo -en "* Currently enabled CPU Freq Power Scheme:\t"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo -e "\nNOTE: To change your processor to performance mode use:
$ echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance"
# EOF