if interface is "exiting"? wired, wireless (Conky)

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

if interface is "exiting"? wired, wireless (Conky)

Post by zAchAry »

From my conky (used on Ubuntu 8.10)

Code: Select all

${font sans-serif:bold:size=8}NETWORK ${if_existing /proc/net/route eth0}(WIRED) ${hr 2}
...
${else}${if_existing /proc/net/route wlan0}(WIRELESS) ${hr 2}
What should I write instead of: /proc/net/route eth0 ?
Image
Help to make Slackware easier Donate to Salix
User avatar
ray
Posts: 87
Joined: 20. Mar 2010, 10:28
Location: United Kingdom

Re: if interface is "exiting"? wired, wireless (Conky)

Post by ray »

You could use it as it is.
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: if interface is "exiting"? wired, wireless (Conky)

Post by zAchAry »

it is not working

Code: Select all

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 2.5
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_title conkyrc_8.1
double_buffer yes
minimum_size 200 200
maximum_width 200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes

default_color 000000
#default_color 979797
#default_color E33D78
#default_color FF005B
#default_color FF7A00

default_shade_color black
default_outline_color white
alignment top_right
gap_x 12
gap_y 80
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes

TEXT
${font sans-serif:bold:size=8}DISKS ${hr 2}
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}

${font sans-serif:bold:size=8}DISK I/O ($diskio) ${hr 2}

${font sans-serif:normal:size=8}Read: $diskio_read${alignr}$diskio_write :Write
${diskiograph_read 26,95} $alignr${diskiograph_write 26,95}

${font sans-serif:bold:size=8}PROCESSORS (${acpitemp}°C) ${hr 2}
${font sans-serif:normal:size=8}$cpugraph
CPU  $cpu%  $cpubar

${font sans-serif:bold:size=8}MEMORY ${hr 2}
${font sans-serif:normal:size=8}RAM $mem ${goto 93}$memperc%  $alignr${membar 6,80}
SWP $swap ${goto 93}$swapperc%  $alignr${swapbar 6,80}

${font sans-serif:bold:size=8}TOP PROCESSES (CPU) ${hr 2}
${font sans-serif:normal:size=8}${top name 1}$alignr${top cpu 1} %
${top name 2}$alignr${top cpu 2} %
${top name 3}$alignr${top cpu 3} %

${font sans-serif:bold:size=8}TOP PROCESSES (RAM) ${hr 2}
${font sans-serif:normal:size=8}${top_mem name 1}${alignr}${top_mem mem 1} %
${top_mem name 2}${alignr}${top_mem mem 2} %
${top_mem name 3}${alignr}${top_mem mem 3} %
${top_mem name 4}${alignr}${top_mem mem 4} %
${top_mem name 5}${alignr}${top_mem mem 5} %

${font sans-serif:bold:size=8}NETWORK ${if_existing /proc/net/route eth0}(WIRED) ${hr 2}

${font sans-serif:normal:size=8}DLS: ${downspeed eth0} kb/s $alignr ${upspeed eth0} kb/s :ULS
${downspeedgraph eth0 26,95 100} $alignr${upspeedgraph eth0 26,95 100}
${totaldown eth0}$alignr${totalup eth0}

IP [LAN]$alignr${addr eth0}
IP [EXT]$alignr${execi 300 wget www.whatismyip.com/automation/n09230945.asp -O - -q}

${alignc}${execi 80000 ~/.conky/scripts/debupdates.sh} Available${else}${if_existing /proc/net/route wlan0}(WIRELESS) ${hr 2}

${font sans-serif:normal:size=8}DLS: ${downspeed wlan0} kb/s $alignr ${upspeed wlan0} kb/s :ULS
${downspeedgraph wlan0 26,95 100} $alignr${upspeedgraph wlan0 26,95 100}
${totaldown wlan0}$alignr${totalup wlan0}

Quality: ${wireless_bitrate wlan0}    ${wireless_link_qual_perc wlan0}% ${alignr}${wireless_link_bar 6,75 wlan0}
ESSID:$alignr${wireless_essid wlan0}
BSSID:$alignr${wireless_ap wlan0}
IP [LAN]$alignr${addr wlan0}
IP [EXT]$alignr${execi 300 wget www.whatismyip.com/automation/n09230945.asp -O - -q}

${alignc}${execi 80000 ~/.conky/scripts/debupdates.sh} Available${endif}${else}(OFFLINE) ${hr 2}




${font zekton:pixelsize=26}${alignc}Disconnected${endif}
Edit: to solved the ${endif} problem, remove the ${endif} before the last ${endif} near TO the last ${endif}:
Before:

Code: Select all

${alignc}${execi 80000 ~/.conky/scripts/debupdates.sh} Available${endif}${else}(OFFLINE) ${hr 2}




${font zekton:pixelsize=26}${alignc}Disconnected${endif}
After:

Code: Select all

${alignc}${execi 80000 ~/.conky/scripts/debupdates.sh} Available${else}(OFFLINE) ${hr 2}




${font zekton:pixelsize=26}${alignc}Disconnected${endif}${endif}
Last edited by zAchAry on 5. Oct 2010, 13:33, edited 2 times in total.
Image
Help to make Slackware easier Donate to Salix
User avatar
ray
Posts: 87
Joined: 20. Mar 2010, 10:28
Location: United Kingdom

Re: if interface is "exiting"? wired, wireless (Conky)

Post by ray »

Do you get any errors when you run conky from the terminal?

Also, you can do

Code: Select all

cat /proc/net/route
and post what you get?
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: if interface is "exiting"? wired, wireless (Conky)

Post by zAchAry »

Code: Select all

etf[~]$ conky -c /home/etf/config+theme/conky/8.1/conkyrc_8.1.txt
Conky: one or more $endif's are missing
Conky: forked to background, pid is 3067
etf[~]$ 
Conky: desktop window (1600003) is subwindow of root window (ac)
Conky: window type - desktop
Conky: drawing to created window (0x3000001)
Conky: drawing to double buffer
sh: /home/etf/.conky/scripts/debupdates.sh: No such file or directory
but replacing /proc/net/route with cat /proc/net/route did the trick. thank you very much for your effort, ray.

Now I need to fix another thing inside + the switching between connectivity modes (Wired/Wireless/Off-line):

- DELETED -
SOLVED: Search (Ctrl+F) for the text:
zAchAry wrote:Edit: to solved the ${endif} problem, remove the ${endif} before the last ${endif} near TO the last ${endif}:
Last edited by zAchAry on 5. Oct 2010, 13:40, edited 3 times in total.
Image
Help to make Slackware easier Donate to Salix
User avatar
ray
Posts: 87
Joined: 20. Mar 2010, 10:28
Location: United Kingdom

Re: if interface is "exiting"? wired, wireless (Conky)

Post by ray »

zAchAry wrote:

Code: Select all

etf[~]Conky: one or more $endif's are missing
Now I need to fix another thing inside + the switching between connectivity modes (Wired/Wireless/Off-line):
Your original code, should pretty much do it for you:

Code: Select all

${font sans-serif:bold:size=8}NETWORK ${if_existing /proc/net/route eth0}(WIRED) ${hr 2}
${else}${if_existing /proc/net/route wlan0}(WIRELESS) ${hr 2}
Do make sure to add ${endif}, after the ${if_existing}.
If you're asking about the debupdates.sh error, not sure what it's meant to do, but you could replace it with the slackware/salix changelogs i guess.
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: if interface is "exiting"? wired, wireless (Conky)

Post by zAchAry »

Oh, oops! I needed to refresh the page again before editing, lol
ray wrote:Do make sure to add ${endif}, after the ${if_existing}.
SOLVED: Search (Ctrl+F) for the text:
zAchAry wrote:Edit: to solved the ${endif} problem, remove the ${endif} before the last ${endif} near TO the last ${endif}:


EDIT_________
I got it working now, only for Wired and Wireless (no Offline mode), in a very odd way:

In order to see what is happening with eth0 you need to ask if wlan0 is exist

Code: Select all

${if_existing /proc/net/route wlan0}(WIRED) ${hr 2}
In order to see what is happening with wlan0 you need to ask if eth0 is exist

Code: Select all

${if_existing cat /proc/net/route eth0}(WIRELESS) ${hr 2}
${if_existing /proc/net/route eth0}(WIRELESS) ${hr 2}
What could be the cause/reason for this?
Image
Help to make Slackware easier Donate to Salix
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: if interface is "exiting"? wired, wireless (Conky)

Post by zAchAry »

zAchAry wrote:What could be the cause/reason for this?
Now (Salix OS 13.37) it is correct.
Image
Help to make Slackware easier Donate to Salix
Post Reply