You are not logged in.

#1 2019-06-05 21:39:11

mountaineerbr
Banned
Registered: 2018-12-08
Posts: 48

[ SOLVED ] Conky if_match statement does not work correctly!

Hello.

I am trying to figure it out for a friend why this if_match statement
in one of his conkies does not work.

He needs conky to trigger kdialog if fan speed is under 1000 rpm.
The commands for fan rpm do have output when run solely, but I do not know
why they do not work? within the if_match statement.

I will post the original line and a modification command that does not use hwmon
or awk in favor of grep,  but that does not help either.

conky.text = [[
${color white}*CPU Fan:$color ${exec sensors | awk '/fan2/ { print $2 }'}rpm ${if_match ${hwmon 1 fan 1} < 1000} ${exec kdialog --title "Alerta do Conky" --msgbox "Rotação CPU Fan abaixo do normal"} ${endif}
]]
conky.text = [[
${if_match ${execi 5 sensors | grep RPM | grep -Eo '[0-9]{2,}'} < 1000}
${exec kdialog --title "Alerta do Conky" --msgbox "Rotação CPU Fan abaixo do normal"}
${endif}
]]

PS: What happens is, the action is always triggered even if "sensors" returns
a value like 2000 or 3000 rpm, so the kdialog keeps popping up...

Last edited by mountaineerbr (2019-06-06 14:27:49)

Offline

#2 2019-06-06 14:27:06

mountaineerbr
Banned
Registered: 2018-12-08
Posts: 48

Re: [ SOLVED ] Conky if_match statement does not work correctly!

OK, I got this right!

Either you call a bash script from conky:

${execpi 10 ~/.conky/fanmonitor.sh}

Or:

Old conky syntax:

${execpi 10 if [[ $(sensors | grep RPM | grep -Eo "[0-9]{2,}") < 1000 ]]; then kdialog --title "Alerta do Conky" --msgbox "Rotação CPU Fan abaixo do normal"; fi}

New conky syntax:

${if_match ${exec sensors | grep RPM | grep -Eo '[0-9]{2,}'} < 1000} ${exec kdialog --title "Alerta do Conky" --msgbox "Rotação CPU Fan abaixo do normal"} ${endif} 

PS: Sometimes the new syntax works, sometimes it does not. I do not know what is going on..

Refs:
https://ubuntuforums.org/showthread.php?t=2357244
https://ubuntuforums.org/showthread.php?t=1897047
and
https://stackoverflow.com/questions/334 … y/33424504

Last edited by mountaineerbr (2019-06-08 04:42:01)

Offline

Board footer

Powered by FluxBB