OH3 - executeCommandLine No such File or directory

I had several instances of executeCommandLine that worked in OH2.5 that won’t work in OH3. I’ve tried many ways to get this working and all come up with

 2021-01-24 10:43:41.687 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Error occurred when executing commandLine '[expect-lite,-c,/home/pi/scripts/Hibernate.elt]'
 2021-01-24 10:43:41.687 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Error occurred when executing commandLine '[expect-lite,-c,/home/pi/scripts/Hibernate.elt]'

The actual command is

 executeCommandLine("/usr/bin/expect-lite -c /home/pi/scripts/Hibernate.elt"

In a command window this works

sudo -u openhab /usr/bin/expect-lite -c /home/pi/scripts/Hibernate.elt

and I’ve tried replacing the spaces with @ and also with a comma I’ve tried adding sudo, and I’ve also added the exact commands to exec.whitelist - does this whitelist apply to simple executeCommandLine commands?

I’ve also changed the owner of the scripts directory and the script file to openhab:openhab and the script permissions are set as 777. Finally both locations are in the secure_path variable in visudo

In OH3 the syntax of executeCommandLine changed.
All arguments need to be separated by a comma.

So it should be:


In case an arguments needs to be returned waiting time needs to be the first argument.

The answer seems to be


and no entry is needed in exec.whitelist

Thanks for your help

Hi all

Im migrating my OH2 installation to OH3

Im trying to adapt the new syntax for the executeCommandLine, so far I haven’t succeded

My OH2 line is::

executeCommandLine("curl -X PUT --digest --user admin:XXX")

What I have tried is this :s

executeCommandLine ("curl", "-X", "PUT", "--digest", "--user", "admin:XXX")
Anyone who can spot what I dont understand?

might be a problem of how the data is being displayed but I do not see “,” between XXX and http.

I had to remove spaces between “ and , and between , and “ before it would work. In the code above you have a space before digest there may be more

1 Like

The command works from Terminal, and I have tried change it to this with no luck:

executeCommandLine ("curl","-X","PUT","--digest","--user","admin:XXX","")

Sorry with spaces removed it works - THANKS

Great, that was what caught me

1 Like