You are not logged in.

#1 2008-03-29 05:36:51

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Error handling for Conky?

I have the following lines in my conkyrc so that it checks the weather for my location. However, if my internet is down, it will break Conky. Does anyone know a way I can do something like "if(internet==true)" and put the lines within that?

${execi 120 wget -nc -P/tmp http://www.weather.gov/data/current_obs/KLEX.xml 2> /dev/null}
${color 808080}temperature: ${color}${execi 120 grep -e "<temp_c>" /tmp/KLEX.xml | \
 sed 's/^[ \t]*//' | sed -e 's/<[^>]*>//g'} °C
${color 808080}pressure: ${color}${execi 120 grep -e "<pressure_mb>" /tmp/KLEX.xml | \
 sed 's/^[ \t]*//' | sed -e 's/<[^>]*>//g'} mb
${color 808080}humidity: ${color}${execi 120 grep -e "<relative_humidity>" /tmp/KLEX.xml | \
 sed 's/^[ \t]*//' | sed -e 's/<[^>]*>//g'}%

Offline

#2 2008-03-29 05:56:41

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: Error handling for Conky?

Write a script with appropriate error handling so that it either generates the needed output or no output then call it from conky.

Offline

#3 2008-03-29 06:01:36

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: Error handling for Conky?

Ahh; thanks. That makes sense. Well as you can see, I am calling the bash functions inside the conky script rather than making conky point to a shell script somewhere else to do the work. I guess I need to change that wget function so that if it cannot execute, it produces a blank xml file... Does anyone know how to do that?

Offline

#4 2008-03-29 06:18:36

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: Error handling for Conky?

I don't think there is any other way then to just let a separate script handle it. As far as I know conky doesn't have conditional statements (last i checked anyway) and no option like that exists for wget that I know of. Why don't you want to just right like a weather-output script or something?

Offline

Board footer

Powered by FluxBB