executeCommandLine failure with Java17 update

I’ve had a rules DSL script that has been working for a few years without problem that calls executeCommandLine. This just started failing, and I think it coincides with a recent update to Java17. I have:

openjdk version “17.0.10” 2024-01-16 LTS
OpenJDK Runtime Environment Zulu17.48+15-CA (build 17.0.10+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.48+15-CA (build 17.0.10+7-LTS, mixed mode, sharing)

The rule is:

  createTimer(now, [|
    logInfo("GetCal", "running script to collect calendar data")
    var String results = executeCommandLine(Duration.ofSeconds(10),"/etc/openhab/scripts/CalSyncHAB.sh")
    logInfo("GetCal", results)

The log shows:

2024-02-08 08:30:30.381 [INFO ] [org.openhab.core.model.script.GetCal] - running script to collect calendar data
2024-02-08 08:30:30.589 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine '[/etc/openhab/scripts/CalSyncHAB.sh]'
2024-02-08 08:30:30.590 [INFO ] [org.openhab.core.model.script.GetCal] - null

That’s not a lot of info to debug. Any suggestions on how to debug further? A few days ago this was working fine - nothing has changed in the OH configuration, so that’s why I suspect the Java17 change.

If I run that script from the command line as the OH user it works fine.

openHAB 4.1.1 (build Release Build)

Hi John,

I had the same error after a recent java update. After a reboot of the Linux machine the errors were gone and everything worked as before.



Thanks for the suggestion. I restarted OH and that appears to have been enough. Very strange that only executeCommandLine fails and doesn’t give any explanation yet everything else worked fine. Anyway, all good now.

1 Like

I had the same issue, commandline returns are null all of a sudden.
Had no interaction or updates on the system.
In my case the reboot dos not help.

Test commandline rule:

    var String Poll_RX

   	Poll_RX = executeCommandLine(Duration.ofSeconds(2), "echo OK");
	logInfo("CMD responce", Poll_RX)


[WARN ] [org.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine ‘[echo OK]’
[INFO ] [penhab.core.model.script.CMD responce] - null

Openhab version: 4.1.1 Stable
openjdk-17-jre-headless is already the newest version (17.0.10+7-1~22.04.1)
Running on GB Brix mini PC
Ubuntu 22.04.4 LTS

Tried with reboots
sudo apt update
sudo apt upgrade
sudo apt autoremove

openhab-cli clean-cache

Any thoughts?

My bad, the test command was incorrect, it started working after updating and restarts.