executeCommandLine() questions

I have been trying without success to find any documentation about executeCommandLine(). The only thing I can find is various threads in this community, but nothing comprehensive. I don’t really know if I’m searhing in the wrong places… Anyway I’ve got a couple of questions:

  1. What exactly are the arguments? I’m currently sending in just a string with the command to be executed, but I’ve seen examples with also a number as argument, what is that? Are there any more possible arguments?

  2. Every call generates a log line (INFO level) informing about the call, which is kinda filling up my log. Any way to make it not do that or is it a question of lowering the log level? (of something like org.eclipse.smarthome.io.net.exec.ExecUtil)

The number is the time in ms to wait for a response from the command line instruction.
It is most of the time rewuired because command line instruction as not instant so give time for your machine to answer.

  1. I don’t know of other arguments

There are some succint documentation in the old wiki:

1 Like

Thanks! Seems there are still some bits that haven’t been migrated over from the old wiki then :slight_smile:

Btw, changing log level to WARN for org.eclipse.smarthome.io.net.exec.ExecUtil made my log more silent again. Feels a bit like a workaround but it works…

It is supposed to be documented here. I was the one who originally brought the docs over from the wiki. I must have messed up. I’ll submit a PR later today.

  1. First argument is the command to execute. When only one argument is provided executeCommandLine immediately exits and runs the command in the background. Second argument is an optional timeout in milliseconds. When supplied executeCommandLine will wait up to that number of milliseconds for the command to complete running and return the text printed by the command.

  2. The only way is to change the log level or filtering that log statement out. See OpenHAB - Filtering event logs.

PR is here: https://github.com/openhab/openhab-docs/pull/769

1 Like