Re: [wmii] looking for a "battery status.sh" - pls help

From: David Guibert <David.Guibert_AT_cdcsp.univ-lyon1.fr>
Date: Thu, 2 Mar 2006 01:19:43 +0100

hi,

> I dont need any bells and whistles - just something simple, that will
> tell me the state of the battery ("AC charging", "battery"), as well
> as the charge %.
you can use the output of the acpi command.

% acpi
Battery 1: discharging, 99%, 05:12:02 remaining

then extract what you need.

for example
% acpi | awk '{print $4}'
99%,

to suppress the comma, add "| sed 's/,//'

to conclude, add the following in status.sh file

bat=`acpi | awk '{print $4}' | sed 's/,//'`
xwrite /bar/$n/data `date` `uptime | sed 's/.*://; s/,//g'` \
                `echo "$bat"`

hope helpfull

ps: to spy my new mail, I use the following which display 0 or 1
meaning that there are some new mails (fetched by an external prog as
fetchmail)

mail=`echo 1 - "$(ls $HOME/Mail/* | grep -v outbox | xargs stat -c '(%X
>= %Y) * ' | tr -d "\n")" 1 | bc`

and this for the status of my ethernet interface:
 - "-" no link detected
 - "+" a link but no address
 - "+ *" link + address

eth1=$(echo `/usr/sbin/ifplugstatus eth1 | sed 's/.*: link beat detected/+/; s/.*: unplugged/-/'` \
"`/sbin/ifconfig eth1 | grep inet | sed 's/.*/\\*/'`")

-- 
David Guibert
Received on Thu Mar 02 2006 - 01:19:59 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:00:29 UTC