LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-01-2011, 01:04 AM   #1
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Rep: Reputation: 48
Conky and wlan0/eth0 if statement


(I'm thinking my issue may be a bug in this version of Conky...)

So I had a conky script that worked perfectly on Arch Linux. I had an "if" statement in effect so if I was using wireless internet, my wlan0 information would be displayed. If I was using eth0 instead, then eth0's information would be displayed. For some reason, this doesn't seem to work in Debian - even though if I "cat" the /sys/class/net/wlan0/operstate file, it clearly states either "up" or "down"

Does anybody have any ideas? Here is my conky configuration (stripped down for troubleshooting and only the important section included):

Code:
 Wireless Networking Section:

${if_existing /sys/class/net/wlan0/operstate up} # if the wlan0 interface is up...
wlan0 ${addr wlan0}
Inbound $alignr ${downspeed wlan0} kb/s
${downspeedgraph wlan0}
Outbound ${upspeed wlan0} kb/s
${upspeedgraph wlan0}
${else}

 Wired Networking Section:

${if_existing /sys/class/net/eth0/operstate up} 
eth0 ${addr eth0}
Inbound ${downspeed eth0} kb/s
${downspeedgraph eth0}
Outbound ${upspeed eth0} kb/s
${upspeedgraph eth0} 
${else}
${endif}
${endif}
 
Old 08-01-2011, 09:28 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Before you try to mess with the code before hand, have you compared the versions of conky on both OS's? I say that because it just might be a small bug depending on the versions that you have.

Cheers,

Josh
 
Old 08-01-2011, 03:39 PM   #3
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
I was not able to see which version of Conky Arch uses.

Are any of you Arch users that just happened to be looking at this post able to tell us?

I believe running the following command will do this (here is my version on Debian):

Code:
conky -v
My output shows me I am running version 1.8.0.
 
Old 08-01-2011, 03:44 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Well on your Debian machine, what exactly is outputted when your configuration is used?
 
Old 08-01-2011, 03:50 PM   #5
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
Code:
cat /sys/class/net/wlan0/operstate
up
However the if statement doesn't seem to be working in Debian correctly...
 
Old 08-01-2011, 03:50 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
That's what I am asking man.... What exactly is happening?
 
Old 08-01-2011, 04:00 PM   #7
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
Right now, I am using wlan0 which is clearly stating up in the operstate file. However, when conky refreshes, displays wlan0 for a split second, then goes back to eth0.
 
Old 08-01-2011, 04:08 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Ahh ok. Within my conky config, I use the following:
Code:
${if_existing /proc/net/route wlan0}
Has been working without a hitch for me. Maybe try it out and let me know how that works?
 
1 members found this post helpful.
Old 08-01-2011, 04:17 PM   #9
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
Quote:
Originally Posted by corp769 View Post
Ahh ok. Within my conky config, I use the following:
Code:
${if_existing /proc/net/route wlan0}
Has been working without a hitch for me. Maybe try it out and let me know how that works?
Okay I tried that, and it still displays wrong. What version of conky are you using?
 
Old 08-01-2011, 04:45 PM   #10
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Honestly I don't know, I don't have my laptop with me, and I am at my girlfriend's house. I am going back to my place either late tonight or tomorrow, if you care to wait until then.
 
Old 08-01-2011, 04:48 PM   #11
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
I guess I'll keep waiting... possibly for a new version of conky. Or maybe I'll find it out of the tree and compile it. We'll see.
 
Old 08-01-2011, 04:52 PM   #12
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Well the latest version is 1.8.1, if you care to install it and see
 
Old 08-01-2011, 05:53 PM   #13
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
Which repository would I find it in? When I do a general apt-get upgrade it isn't showing any updates.
 
Old 08-01-2011, 05:59 PM   #14
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Original Poster
Rep: Reputation: 48
Oh, I just found out the strangest thing!

If I have:

Code:
if_existing /sys/class/net/eth0/operstate up
It displays wlan0

If I have

Code:
if_existing /sys/class/net/wlan0/operstate up
It eisplays eth0

This MUST be a bug, right? Again, it all worked fine in Arch Linux...

So whatever is happening, it is mixing up the interfaces. If I add a third interface (usb0 for tethering), it just gets all screwed up and ommits parts of the conky script.

I wonder if the program is interpreting if as !if
 
Old 08-02-2011, 12:10 AM   #15
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hmmm.... that is weird man. I do have one more trick up the sleeve for you to try.... Try using the following instead of if_existing:
Code:
${if_up wlan0}
I'm sure that will definitely work, since it is internal to conky, as far as detecting the network.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No networks at all (eth0, wlan0) arsci Linux - Networking 1 09-11-2010 02:48 AM
NAT eth0 through wlan0? sysslack Linux - Networking 2 08-17-2009 06:37 AM
dhcp wlan0 before eth0? datadriven Slackware 2 01-22-2009 12:26 PM
Eth0 to WLAN0 how do i rename it? XeoNoX Linux - Wireless Networking 5 02-22-2004 05:54 AM
route wlan0 to eth0 hwood7587 Linux - Networking 1 07-13-2003 06:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration