Exec-Binding on Paper UI with openHAB2

I’m running openHAB2 on a Raspberry. I’m trying to get a sh.-Script running with the Exec-Binding over the Paper UI without any rules,…

What i’ve done so far:

  • tested sh-Script (works perfect if it is started manually on UNIX)
  • gave the folder and script 777 rights
  • added openhab as indo the sudo users group
  • checked all logs (openhab, user, syslog,…) - No entries
  • set the script to Autoruin avery 10 seconds - Time will be updated and so it looks, that teh script tries to run
  • copied the sh-File frome the home-Folder to the openhab-Scripts-Folder
    -…

I’ve created the Exec-Thing in manually in Paper-UI and in the Simple Mode Paper UI created all items…

Anybody any idea why the script will not run?

So what’s the script?

It was just a simple espeak-script to be executed.
Must have to do something with the audio-rights on UNIX…

Did you reboot after adding openhab to the sudoers? Have a look here.
What information is desplayed when you run the skript as user openhab?

sudo -u openhab Test_Sprachausgabe.sh

Does that run? if yes then you could try to, add a rule to display what is prompted when the skript is executed.
Bind an item to the output channel of your thing and log the returned information of the execution.

String exec_Out { channel="exec:command:< YOURTHING>:output" }
rule "Exec Prompt"
  when
    Item exec_Out changed 
  then
      logInfo("Exec prompt", "\n" + exec_Out.state +"\n" )
end

You can then see the output in the log files or in the karaf console.

Hi Josar,

with user “openhab” i only get…

pi@raspberrypi:/etc/openhab2/scripts $ sudo -u openhab Test_Sprachausgabe.sh
sudo: Test_Sprachausgabe.sh: Befehl nicht gefunden

If i execute my skript this works fine.

sh testSkript.sh
hallo

As openhab also

sudo -u openhab sh ./testSkript.sh
hallo

If i try to execute it without making it executabel in both cases it does not execute.

./testSkript.sh
-bash: ./testSkript.sh: Permission denied
sudo -u openhab ./testSkript.sh
sudo: ./testSkript.sh: command not found

Making it executable and it runs.

sudo chmod +x testSkript.sh
./testSkript.sh
hallo
sudo -u openhab sh testSkript.sh
hallo

Somehow your file permissions changed when copying! :thinking:

When you copy a file, you are creating a new file. So, its (new file) permissions depends on the current file creation mask, which you change via umask command. Read man umask for more information.
Use the -p option to preserve the permissions when you copy a file or set the permissions afterwards.

cp -p original.sh copy.sh