Openhab Executecommandline permissions

I’m trying to run executeCommandLine but it won’t run. I’m pretty sure it has to do with the permissions (I’m pretty new in linux). I’m running on a raspberry pi (raspbian jessie). Openhab is running as user and group openhab:openhab.

I’m executing this line:

The script writes to a log file when it is run. I have done chown and chmod 777 on the file. But it still won’t execute

ls -l
-rwxrwxrwx 1 openhab openhab 95 Feb 15 16:56

What do I miss here? Shouldn’t the chmod 777 allow the script to run?

What is the output of the command line? Use:

val results = executeCommandLine("/etc/openhab/pyicloud/", 5000)
logInfo("Exec", results)

Does openhab have permission to write to the log file? The openhab user has to have permission to do everything that script tries to do too, not just permission to execute the script itself.

You were correct, did not have permission to the other files. Problem
solved! Thanks

mån 15 feb. 2016 kl 18:19 skrev Rich Koshak


I struggle with a similar case:
This one just works fine:
executeCommandLine("sudo /sbin/reboot", 5000)
where ls -l returns
lrwxrwxrwx 1 root root 4 Oct 13 2013 /sbin/reboot -> halt

When I try to shutdown openvpn, it does not work:
executeCommandLine("sudo /etc/init.d/openvpn stop", 5000)
In this case the permissions look like this:
-rwxr-xr-x 1 root root 8958 Feb 24 2012 /etc/init.d/openvpn

I don’t want to mess up the permissions, because I am not a linux pro.

I tried possible everything:
putting it into a script and run from a rule,
link it directly to an item with { ON: …
Any suggestion for a workaround?
Thanks in advance.

Just got it - same problem like in a very early stage of OH:

Sorry for my low performance brain.