Rule cant find Script directory

Hi, thnx for the quick answer. I just tried the standard Synology admin and it works, with the Openhab user it gives me a no permission error. “-sh: /volume1/web/mirhome.log: Permission denied”
I changed all the permissions on the NAS to the same as the admin user has. I still get the error.
Is there a way to start the script with the admin NAS user ?

What about full path to the tac command?

No. Just give it proper “any” permissions.
And running OH on Synology is not really recommended, expect all sorts of issues there.

That should be the full path… at least for the synology

No. You are not sure where the script is run from and what path environment is set. Usually you can type which tac or whereis tac to conf the complete path.
Even if it was in the current working directory then it should be specified as ./tac. Many times the current directory is not in the execution path.

Hi, not sure what you mean. How can i find the full path?
Please excuse my little knowing of all this stuff.
From the cli its working now with the openhab user rights.
From the rule i still get: “couldn’t execute commandLine ‘/volume1/homes//openhab/conf/scripts/openhablogs.sh’”

It is good it runs as the openhab user but when you login as that user a path environment is set up that is likely different than when the script is run. That is why it is safest to put the full path for all commands in a script. Tou need the path for the tac command.

How do i get the full path ?

One of these commands can tell you the full path.

Here is the answer.

Thnx a lot.
I get /bin/tac in the console. So how do i use that in my rule now?
or do i need to put that in the script before the tac command ?

In your script, replace tac with /bin/tac. You are then telling the system where that command is located. Hopefully that will resolve the issue. If not, it is good standard practice anyway.

Hi, still not working.
I think the problem i have is that the path to the Script is not right, cause it cant find the script itself.
But i cant see an error in the path…
Funny that it works in cli…but not in a rule…

I have not executed commands with OpenHAB.
There is a hint here.


In your rule you could try executeCommandLine("/volume1/homes/openhab/conf/scripts/openhablogs.sh", 10000)
Apparently you need to specify how long the script may run.

EDIT: More troubleshooting hints. How to solve Exec binding problems

Tried a little more and now i get this message:
“Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “/volume1/homes/openhab/conf/scripts/openhablogs.sh” (in directory “.”): error=2, No such file or directory)”

?! Does this mean it finds the script?

It means it doesn’t find the script or the openhab user doesn’t have permission to read/execute it.

same as above…I think you have permission issue.
Try giving your openhab user permission on the script with:

chown openhab:openhab /volume1/homes/openhab/conf/scripts/openhablogs.sh

Of course if “openhab” is the user your sinology created.

And be sure your script is executable (you said you issued the command inside the script from CLI not the script itself) with:

chmod u+x /volume1/homes/openhab/conf/scripts/openhablogs.sh

If none of that it’s working you can try to “open” permission to “everyone” giving this command

chmod 777 /volume1/homes/openhab/conf/scripts/openhablogs.sh

But I would first go trying to give specific permission to openhab…I don’t personally like giving the 777 permission.

Just a silly question: you don’t happen to run OH in a Docker conatiner by any change? :wink:
Some Synology models do support that (the ones with an Intel CPU), so just checking…

Hi thnx a lot for the input.
Running chown openhab:openhab /volume1/homes/openhab/conf/scripts/openhablogs.sh just gives me the error invalid group.
Running chown openhab:administrators /volume1/homes/openhab/conf/scripts/openhablogs.sh gives me: “chown: changing ownership of ‘/volume1/homes/openhab/conf/scripts/openhablogs.sh’: Operation not permitted”
All done with the Synology SU

chmod gives me a no rights error with the openhab user. With the synology SU it doesnt give any error.

I dont run a docker container. i guess it would make it even more difficult for a user with no knowledge of Linux/docker etc.

Hi,

i have done it. Thnx to your help.
After checking and changing the rights i tried running the script from the cli.
It generated an error: /bin/bash^M: bad interpreter:
After deleting the windows line ending the rule ran like a charm.

Thnx again for all the help to point me to the right solution.