Read the statement by Michael Teeuw here.
run Linux command from a mm2 module
-
@sean
See these also.
Thanks!
-
@sdetweil said in run Linux command from a mm2 module:
let me see what I can do.
Will be tomorrow.Thanks! Anything you can offer will be much appreciated.
This what I have, and sent to the module.js
-
@mykle1
test.jsvar str = `nouveau-pci-0100↵Adapter: PCI adapter↵fan1: 1170 RPM↵temp1: +43.0°C (high = +95.0°C, hyst = +3.0°C)↵ (crit = +105.0°C, hyst = +5.0°C)↵ (emerg = +135.0°C, hyst = +5.0°C)↵↵coretemp-isa-0000↵Adapter: ISA adapter↵Core 0: +46.0°C (high = +83.0°C, crit = +99.0°C)↵Core 1: +41.0°C (high = +83.0°C, crit = +99.0°C)↵Core 2: +46.0°C (high = +83.0°C, crit = +99.0°C)↵Core 3: +38.0°C (high = +83.0°C, crit = +99.0°C)↵↵f71858fg-isa-0a00↵Adapter: ISA adapter↵+3.3V: +3.31 V ↵3VSB: +3.30 V ↵Vbat: +3.20 V ↵fan1: 1910 RPM↵fan2: 1069 RPM↵fan3: 0 RPM ALARM↵temp1: +34.5°C (high = +70.0°C, hyst = +60.0°C)↵temp2: +29.5°C (high = +100.0°C, hyst = +85.0°C)↵temp3: +36.4°C (high = +100.0°C, hyst = +85.0°C)↵↵` var pattern = [ "(fan[0-9]):[\\s]+([0-9]+ RPM)", "(temp[0-9]):[\\s]+(\\+[0-9\\.]+°C)", ] for (i = 0; i < pattern.length; i++) { var rx = new RegExp(pattern[i], "g") var found do { found = rx.exec(str) if (found) console.log(found[1], found[2]) } while(found) }
RESULT
-
@sean said in run Linux command from a mm2 module:
RESULT
Excellent sean! Working here as well. You have my eternal gratitude. :thumbsup:
EDIT
Using your example above as a guide I was able to add to the pattern array successfully.
My addition
"(Core [0-9]):[\\s]+(\\+[0-9\\.]+°C)"
Result
Now I’ll do the ones I want. Thank you again, sean. This is awesome!
-
@mykle1 @sean nice work. Sorry I ran out of time.
-
No worries, bro. I appreciate your interest and concern. I’m sure I’ll need help in the future. You can get in on that. :-)