You are not logged in.

#1 2009-05-12 13:18:17

yphqyn
Member
Registered: 2009-04-23
Posts: 20

[SOLVED] dzen "is network connection?"

hii

how can i do somthing like network connection state :
"is connection -> show two computers in blue color on dzen"
"isnt connection -> show two computers in grey color on dzen"

my question is: where i can get info about it (is connection, or is not connection to network)?

regards yph

Last edited by yphqyn (2009-05-12 15:09:40)

Offline

#2 2009-05-12 13:59:10

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: [SOLVED] dzen "is network connection?"

'ping www.google.com -c 1' and then some grep/if stuff to check the connection.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#3 2009-05-12 14:45:04

yphqyn
Member
Registered: 2009-04-23
Posts: 20

Re: [SOLVED] dzen "is network connection?"

i have something like this...
but is dont works good sad

#!/bin/bash

FN='-misc-fixed-medium-r-normal--10-70-100-100-c-60-iso8859-1'
DZEN="dzen2 -fn $FN"

while true; do
    

    INF=$(ping -c 1 www.wp.pl | awk '{if($1 != "") printf "^fg(green)net^fg()"; else printf "^fg(red)net^fg()"}')

    echo "$INF"
    sleep .1
done | $DZEN

some tips ?
regards yph

Offline

#4 2009-05-12 15:09:03

yphqyn
Member
Registered: 2009-04-23
Posts: 20

Re: [SOLVED] dzen "is network connection?"

ok, i resolve problem:

#!/bin/bash

FN='-misc-fixed-medium-r-normal--10-70-100-100-c-60-iso8859-1'
DZEN="dzen2 -fn $FN"


while true; do

NET=$(cat /sys/class/net/eth0/carrier | awk '{if ($1 == "1") printf "^fg(green)net^fg()"; else printf "^fg(red)net^fg()"}')

    echo "$NET"
    sleep 1
done | $DZEN

if "net" is in green, we have network connection, else (red) we have'nt
regards yph

Offline

Board footer

Powered by FluxBB