Executecommandline curl error

  • Platform information:
    • Hardware: intel i5 4790t
    • OS: Debian (openhab in docker container)
    • Java Runtime Environment: java 11
    • openHAB version: 3.1
  • Issue of the topic:

i got error to execute curl command and seems fine in ssh terminal and i got error
2021-07-23 08:50:54.420 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine ‘[curl -X POST http://192.168.1.103:5154/control/shutdown]’

this is i put in the rule ui openhab
executeCommandLine(Duration.ofSeconds(5),“curl -d POST http://192.168.1.103:5154/control/shutdown”)

kinda bang my head since this old rule that i use for oh 2.5 are work but not in 3
executeCommandLine(“curl -X POST http://192.168.1.103:5154/control/shutdown”,5000)

kinda hope someone here giving correct rule since im really noob for scripting like this many thanks

Pay close attention to the last example in the Docs:

Compared to OH2 in OH3 you need to separate all the arguments from the command that is being used. So the command would be

What you also can do is to put the command and all it’s arguments into a shell script and call the script instead. An advice would be to assign the output of executeCommandLine to a variable for further analysis.

it didnt work so just as your advice i use script instead and it work thanks for the help

1 Like