SOLVED: ExecuteCommandLine stopped working

Hi there! :slight_smile:

Since yesterday, my rule for getting weather infos stopped working.
The action runs a shell script and redirect the result into an item:

configuration: {}
triggers:
  - id: "1"
    configuration:
      cronExpression: 0 0/5 * * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        var result = executeCommandLine(Duration.ofSeconds(60),
        "/usr/local/bin/wego_current2aha.sh");

        logInfo("cmd", result);

        WegoCurrent.postUpdate(result);
    type: script.ScriptAction

Log:

024-02-28 07:07:51.186 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine ‘[/usr/local/bin/wego_current2aha.sh]’
2024-02-28 07:07:51.187 [INFO ] [org.openhab.core.model.script.cmd ] - null

Running manually, even as user openhab, is fine:

tippi@odroid:~$ sudo -i -u openhab
[sudo] Passwort für tippi: 

openhab@odroid:~$ ls -al /usr/local/bin/wego_current2aha.sh
-rwxrwxr-x 1 root root 51 Sep 23 18:50 /usr/local/bin/wego_current2aha.sh

openhab@odroid:~$ /usr/local/bin/wego_current2aha.sh
Wetter für Groß Döbbern, DE @ 07:09 Uhr

 <span style="color: rgb(255,255,0);"> _`/&quot;&quot;</span><span style="color: rgb(192,192,192);">.-.    </span> Leichter Regen
 <span style="color: rgb(255,255,0);">  ,\_</span><span style="color: rgb(192,192,192);">(   ).  </span> <span style="color: rgb(0,255,175);">3</span> (<span style="color: rgb(0,255,135);">4</span>) °C       
 <span style="color: rgb(255,255,0);">   /</span><span style="color: rgb(192,192,192);">(___(__) </span> <span style="font-weight:bold;">↘</span> <span style="color: rgb(215,255,0);">10</span> km/h      
 <span style="color: rgb(135,175,255);">    ´ ´ ´ ´  </span>                
 <span style="color: rgb(135,175,255);">   ´ ´ ´ ´   </span> 0.0 mm/h

I did not chance anything in relation to openHAB.
I only made an ubuntu system update, but I cannot see anything suspicious with the packages:

2024-02-27 13:35:36 status installed login:arm64 1:4.8.1-1ubuntu5.20.04.5
2024-02-27 13:35:39 status installed passwd:arm64 1:4.8.1-1ubuntu5.20.04.5
2024-02-27 13:37:13 status installed postgresql-client-common:all 257.pgdg20.04+1
2024-02-27 13:37:13 status installed firefox:arm64 123.0+build3-0ubuntu0.20.04.1
2024-02-27 13:37:14 status installed libssl1.1:arm64 1.1.1f-1ubuntu2.22
2024-02-27 13:37:14 status installed unzip:arm64 6.0-25ubuntu1.2
2024-02-27 13:37:15 status installed openjdk-11-jre-headless:arm64 11.0.22+7-0ubuntu2~20.04.1
2024-02-27 13:37:15 status installed binutils-common:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:15 status installed libpq5:arm64 16.2-1.pgdg20.04+1
2024-02-27 13:37:15 status installed linux-libc-dev:arm64 6.1.78-202402221613~focal
2024-02-27 13:37:15 status installed libctf-nobfd0:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:16 status installed postgresql-client-15:arm64 15.6-1.pgdg20.04+1
2024-02-27 13:37:16 status installed openjdk-11-jre:arm64 11.0.22+7-0ubuntu2~20.04.1
2024-02-27 13:37:16 status installed dnsmasq-base:arm64 2.90-0ubuntu0.20.04.1
2024-02-27 13:37:16 status installed dns-root-data:all 2023112702~ubuntu0.20.04.1
2024-02-27 13:37:29 status installed postgresql-common:all 257.pgdg20.04+1
2024-02-27 13:37:29 status installed libnm0:arm64 1.22.10-1ubuntu2.4
2024-02-27 13:37:29 status installed openjdk-17-jre-headless:arm64 17.0.10+7-1~20.04.1
2024-02-27 13:37:29 status installed libtiff5:arm64 4.1.0+git191117-2ubuntu0.20.04.12
2024-02-27 13:37:29 status installed gir1.2-nm-1.0:arm64 1.22.10-1ubuntu2.4
2024-02-27 13:37:29 status installed libbinutils:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:29 status installed openssl:arm64 1.1.1f-1ubuntu2.22
2024-02-27 13:37:30 status installed grafana:arm64 10.3.3
2024-02-27 13:37:30 status installed firefox-locale-de:arm64 123.0+build3-0ubuntu0.20.04.1
2024-02-27 13:37:30 status installed libxml2:arm64 2.9.10+dfsg-5ubuntu0.20.04.7
2024-02-27 13:37:37 status installed postgresql-15:arm64 15.6-1.pgdg20.04+1
2024-02-27 13:37:37 status installed libctf0:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:37 status installed tcpdump:arm64 4.9.3-4ubuntu0.3
2024-02-27 13:37:37 status installed bind9-libs:arm64 1:9.16.48-0ubuntu0.20.04.1
2024-02-27 13:37:38 status installed postgresql-client-16:arm64 16.2-1.pgdg20.04+1
2024-02-27 13:37:38 status installed binutils-aarch64-linux-gnu:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:46 status installed network-manager:arm64 1.22.10-1ubuntu2.4
2024-02-27 13:37:46 status installed binutils:arm64 2.34-6ubuntu1.9
2024-02-27 13:37:47 status installed openjdk-17-jdk-headless:arm64 17.0.10+7-1~20.04.1
2024-02-27 13:37:47 status installed bind9-host:arm64 1:9.16.48-0ubuntu0.20.04.1
2024-02-27 13:37:53 status installed postgresql-16:arm64 16.2-1.pgdg20.04+1
2024-02-27 13:37:54 status installed network-manager-config-connectivity-ubuntu:all 1.22.10-1ubuntu2.4
2024-02-27 13:37:55 status installed bind9-dnsutils:arm64 1:9.16.48-0ubuntu0.20.04.1
2024-02-27 13:37:55 status installed postgresql:all 16+257.pgdg20.04+1
2024-02-27 13:37:55 status installed mime-support:all 3.64ubuntu1
2024-02-27 13:37:55 status installed hicolor-icon-theme:all 0.17-2
2024-02-27 13:37:55 status installed gnome-menus:arm64 3.36.0-1ubuntu1
2024-02-27 13:37:55 status installed libc-bin:arm64 2.31-0ubuntu9.14
2024-02-27 13:37:56 status installed systemd:arm64 5:245.4-4ubuntu3+202310161612~focal
2024-02-27 13:38:05 status installed man-db:arm64 2.9.1-1
2024-02-27 13:38:05 status installed dbus:arm64 1.12.16-2ubuntu2.3
2024-02-27 13:38:06 status installed desktop-file-utils:arm64 0.24-1ubuntu3

System informations:

  • openHAB 4.1.1 Release Build
    • deb [signed-by=/usr/share/keyrings/openhab.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main
  • Ubuntu 20.04.6 LTS

Must be something trivial, but cannot find it :frowning:
Thanks for your help! Tippi …

afaik you should better call the shell explicitly:

var result = executeCommandLine(Duration.ofSeconds(60), "/bin/bash", "/usr/local/bin/wego_current2aha.sh")

Please be aware that dsl rules do not need a semicolon in every line. The only command the semicolon is needed is return; as it needs to be set to return no value (this is the ; for).

1 Like

Hi Udo!
Thank your for your response!

I just made another apt full-upgrade and reboot and now … everything is working as expected :roll_eyes:

The system only changed the following packages:

2024-02-28 08:43:30 status installed less:arm64 551-1ubuntu0.2
2024-02-28 08:43:31 status installed docker-compose-plugin:arm64 2.24.6-1~ubuntu.20.04~focal
2024-02-28 08:43:31 status installed man-db:arm64 2.9.1-1
2024-02-28 08:43:32 status installed mime-support:all 3.64ubuntu1

I have no idea what the heck was going on … as long as it works now!

PS: yes, the semicolon … a habit :grin:

Greetings, Tippi

1 Like

I think that might be the issue. I had the same problem after the updating Java recently. No other change, just that update, and executeCommandLine stopped working. A restart of OH resolved the issue. Strangely nothing else was broken, just that one command. I’ve had no problem since the restart.

1 Like

Same here, after updating openjdk executeCommandLine stopped working. A restart of OH fixed the issue. Haven’t had this before, but ok for me

As an FYI to anyone updating Java 17 - this happened again with the latest update. Needs an OH restart to resolve the executeCommandLine issue.

1 Like