Linux.com

Re:Improve the AVG calc

Posted by: Administrator on February 17, 2007 12:35 PM
If you have two batteries like me you can modify the script like this:

count=0
for batery in `ls -1A<nobr> <wbr></nobr>/proc/acpi/battery/`; do

                bat_dir="/proc/acpi/battery/$batery/"

                AVG[$count]=awk "/remaining/ {a=\"`awk '/last full/ {print $4}' $bat_dir/info`\"; avg=\$3*100/a; print avg}" $bat_dir/state

                let count++
done
if [ "${AVG[0]}" -lt '4' ] && [ "${AVG[1]}" -lt '4' ]; then

This way you will prevent the hibernation when the first battery runs out.

#

Return to Improved ways to suspend and hibernate a laptop under Linux