You are not logged in.
Pages: 1
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
'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
i have something like this...
but is dont works good
#!/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
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
Pages: 1