OH2 bash script exec 2 binding

Hey

i’m trying to run a bash script in an interval of X seconds.

My script does work without a problem but when i try to execute it with openhab with this .thing part

Thing exec:command:btf [command="sudo /home/openhabian/bt.sh", interval=6, timeout=120 ]

and then let it display as a String in PaperUI

String output "[%s]" { channel="exec:command:btf:output" }

i only get this answer

We trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things:    #1) Respect the privacy of others.    #2) Think before you type.    #3) With great power comes great responsibility.sudo: no tty present and no askpass program specifiedWe trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things:    #1) Respect the privacy of others.    #2) Think before you type.    #3) With great power comes great responsibility.sudo: no tty present and no askpass program specified

if i run the command in the terminal all is working without a problem and i get the right result which is ON / OFF as an echo.

Also tried it without sudo then its always showing “OFF” even tho if i then manually run the script i get “ON”

Did you setup sudo to need no passwords for user openhabian?
Then type once

sudo -u openhabian sudo /home/openhabian/bt.sh

(I did not try this, but in theory it should work ;))