github email rss
Conky if_up
Mar 25, 2011
One minute read

It seems (at least in my setup) that the if_up variable in conky wasn't working as expected. If you want to check whether an interface is up or down you could use the following instead:

${if_existing /sys/class/net/eth1/operstate up}

But, there might be times that the above returns "unknown" rather than up or down. Another way to check is by looking at the route table:

${if_existing /proc/net/route eth1}

On my setup (netbook: wifi (eth1) or wired (eth0)), the whole “check what interface is up and act accordingly” is as follows:

${if_existing /proc/net/route eth1}
.... report ssid, speed, etc....
${else}${if_existing /proc/net/route eth0}
...report just speed and "Wired" instead of ssid...
${else}
.... print "Network Unavailable" ....
${endif}${endif}

Back to posts