[Debian-eeepc-devel] Low battery and ugly shutdown problems

Pablo García Corzo ozrocpablo at gmail.com
Tue Jun 3 10:07:08 UTC 2008


Hello.

I'm running Linux EeeOS 2.6.24-1-686 on my 701 and found that
gnome-power-manager don't warn me when battery is low and my system runs out
of battery until it shuts down uncleanly making errors on my filesystem.

Probably there's some other power manager daemon that works well, but I've
written a stupid script that looks for remaining battery every 2 minutes
warning me with an xmessage when battery is lower than 20% and shutting down
my machine cleanly when it reaches 10%.

Here it is:

##!/bin/sh
> while true
> do
> if ! grep -q on-line /proc/acpi/ac_adapter/AC0/state ; then
>         BAT_DIR=/proc/acpi/battery/BAT0
>         FULL_BAT=`grep 'last full capacity' ${BAT_DIR}/info | awk '{ print
> $4 }'`
>         CUR_BAT=`grep 'remaining capacity' ${BAT_DIR}/state | awk '{ print
> $3 }'`
>         AVG=`expr $(expr ${CUR_BAT} \* 100) / ${FULL_BAT}`
>
>         if [ "$AVG" -le "20" ]; then
>             xmessage Warning, Low Battery... $AVG &
>         fi
>         if [ "$AVG" -le "10" ]; then
>             xmessage I'll shut down in 2 minutes unless you connect to AC.
> &
>             sleep 120
>             if ! grep -q on-line /proc/acpi/ac_adapter/AC0/state ; then

                # YOU MAY CHANGE THIS ACCORDING TO YOUR DE.
>                 gdm-control --shutdown
>                 lxsession -exit
>             fi
>         fi
> fi
> sleep 120
>
> done
>
>
I just run it in background when my lxsession starts.

Hope to be helpfull and excuse my bad English.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/debian-eeepc-devel/attachments/20080603/874c8ab8/attachment.htm 


More information about the Debian-eeepc-devel mailing list