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:
executeCommandLine("/etc/openhab/pyicloud/run.sh")
The script writes to a log file when it is run. I have done chown and chmod 777 on the run.sh file. But it still won’t execute
ls -l
-rwxrwxrwx 1 openhab openhab 95 Feb 15 16:56 run.sh
What do I miss here? Shouldn’t the chmod 777 allow the script to run?
val results = executeCommandLine("/etc/openhab/pyicloud/run.sh", 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.
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: …
etc.
Any suggestion for a workaround?
Thanks in advance.