openHab3: Failed to execute commandLine

Hi all,

A proper explanation with some examples is now included in the docs.
Actions | openHAB

Hi all,

I upgradet some days ago from 2.5 to 3.4 and today I was working on updating the rules which use executeCommandLine.
Right now I get no errormessage anymore but it doesn’t add the line of text to the log file. With “>> /var/log/openhab/zigbee.log 2>&1” it worked at 2.5.

var String zigbee_thing = "ZB Online again"
var String zigbee_log_msg = (now.toString("dd-MM-yyyy HH:mm:ss") + zigbee_thing)
executeCommandLine(Duration.ofSeconds(5),"/bin/sh","-c","echo",zigbee_log_msg,">> /var/log/openhab/zigbee.log 2>&1")

Any hints appreciated.

Check if it works as described in: How to use "executeCommandLine" correctly - #2 by NorbertHD
In that solution everything including echo and later needs to be part of one string.

That’s it - many thanks!!!

1 Like