|
2010-02-22
, 00:48
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#2
|
The Following 4 Users Say Thank You to No!No!No!Yes! For This Useful Post: | ||
|
2010-02-22
, 00:48
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#3
|
|
2010-02-22
, 14:47
|
Posts: 2,014 |
Thanked: 1,581 times |
Joined on Sep 2009
|
#4
|
|
2010-02-22
, 16:45
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#5
|
df | awk '$1 == "rootfs" {print $5}'
df | awk 'BEGIN { FS="[ %]+" } $1 == "rootfs" { print $5 "%"; if ($5 < 90) exit 0; else if ($5 < 95) exit 1; else exit 2 }'
The Following User Says Thank You to No!No!No!Yes! For This Useful Post: | ||
|
2010-02-22
, 16:48
|
Posts: 2,014 |
Thanked: 1,581 times |
Joined on Sep 2009
|
#6
|
Here is the Normal version of the "Rootfs(%):" command:
Here is the equivalent Beeconified version of the "Rootfs(%):" command which you can replace:Code:df | awk '$1 == "rootfs" {print $5}'
With the beeconified version of the command, the awk statement will return:Code:df | awk 'BEGIN { FS="[ %]+" } $1 == "rootfs" { print $5 "%"; if ($5 < 90) exit 0; else if ($5 < 95) exit 1; else exit 2 }'
Exit Status 0 (Green Beecon) for less the 90% rootfs file system full
Exit Status 1 (Yellow Beecon) for less the 95% rootfs file system full
Exit Status 2 (Red Beecon) for 95% or more rootfs file system full
|
2010-02-22
, 17:46
|
|
Posts: 144 |
Thanked: 75 times |
Joined on Dec 2009
@ Israel
|
#7
|
The Following User Says Thank You to late666 For This Useful Post: | ||
|
2010-02-22
, 18:06
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#8
|
Very cool - One imagines this can be applied to pretty much any % based command.
ping -q -c 3 server1 | awk 'BEGIN { FS="[ \/]+"; rt=0 } $1 == "round-trip" { rt=1; print $6 "\n" $7 "\n" $8 "\n(ms)"; if ($8 < 100) exit 0; else if ($8 < 200) exit 1; else exit 2 } END { if ( rt == 0 ) exit -1 }'
|
2010-02-22
, 19:36
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#9
|
It's a cool idea, but I think a more elegant way to do this is to stick to the half transparent black rectangle like the one in the original desktop command execution widget..
It would also save up on space.
|
2010-02-24
, 01:14
|
|
Posts: 700 |
Thanked: 846 times |
Joined on Nov 2009
|
#10
|
Nokia-N900-51-1:/home/user/MyDocs# wget wget: missing URL Usage: wget [OPTION]... [URL]... Try `wget --help' for more options. Nokia-N900-51-1:/home/user/MyDocs#
apt-get install wget
wget -q -O - http://m.mlb.com/scores/`date +%Y%m%d`/ | awk 'BEGIN{t="NYY";m=0}/<td>.+<\/td>/{split(gensub(/<[^>]*>/,"","g"),a);if(a[1]!=t && a[3]!=t && a[4]!=t)next;m=1;if(a[2]=="vs."){print a[1] "\n" a[3] "\n" a[4],a[5];exit 1}print a[1],a[2] "\n" a[4],a[5] "\n" a[6];if((a[4]==t&&a[5]>a[2])||(a[1]==t&&a[2]>a[5]))exit 0;if(a[5]==a[2])exit 1;else exit 2}END{if(m==0){print "No\nMatch!\n";exit 1}}'
t="NYY"
Based on an idea and widget by cpscotti ("Desktop Command Execution Widget" R E S P E C T & Kudos, Dude!) and due to personal needs, I forked developments towards:
Queen BeeCon Widget
AT FULL POWER!
Queen BeeCon Widget is a highly customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for Maemo 5 Fremantle and the N900.
The Widget is based on the execution of external Shell/OS Commands which can be either as simple as one-liner statements or as complex as articulated shell scripts, which, for example, fetch, parse and aggregate contents retreived from the system, other applications or the Internet.
There are two basic Widget types, Beecons and Snippets:
Beecons are small hexagonal cells whose background color or associated image/icon changes according to the executed Command Exit Status.
Beecons can handle virtually unlimited Command Exit Status:
Snippets are normal text/graphic boxes with fixed background color and images which is not influenced by the executed Command Exit Status.
See WIKI
Enjoy, No!No!No!Yes!
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
Last edited by No!No!No!Yes!; 2010-09-24 at 06:35.