I have some issue on running a shell schript triggert by a rule in OH2.5. Unfortunately non of topcis discussed in this forum gave me the right hint to resolve my issue.
I created a very simple script, which works fine on manual execution.
However when I try to run it from OH it is not executed. Althought according to log the comand is executed the file 1local.txt is not creted.
Any hints for resolving that topic are very much apreciated.
thank you
Michael
*Platform information:
Hardware: RB 3+
OS: Raspbian
openHAB version: 2.5
rule:
rule âgat2triggerâ
when
Item Gat2Trigger_Run received command ON
then
logInfo(âgat2triggerâ,âRule to check Gate2 triggeredâ)
executeCommandLine(âsudo /home/openhabian/remote_test.shâ)
end
Script is being executed as user openhab but touch is to be done in the openhabian users directory.
This only will work if sudo can be executed as user openhab without any interactivity.
Change the script to do the touch in the /tmp directory to see if the file is being created there.
In case it is created you can also see the owners rights / the user that created the file.
I spent the whole weekend trying to get a simple script to run from OpenHAB. I already have several running that send commands to a library which controls the lights. It was an absolute bear to get to work. It would run fine in the terminal but not in a rule. Permissions needed to be fixed on the script, openhab user had to be in the group that owned the library and the last and most difficult one to run down was that the library created a pipe to communicate on the net and openhab user needed rights to that pipe. That one runs
This weekend was trying to get another script that plays a sound file using mpg123. Same thing, beating my brains out trying to figure out what is wrong.
To help things along, I found it useful to give openhab user terminal access so you can run the script in the terminal as user openhab
Dear all,
thank you for your quick and helpful replies. Your hints were very helpful to resolve the problem. The issues was the user openhab that was not authorized to create a file in that directory (owned by openhabian)