Running openhab 2 on a synology NAS.
Im trying to run a script from the script folder in my openhab installation.
The script looks like this:
tac /volume1/homes/openhab/userdata/logs/mirhome.log | head -n 10 > /volume1/web/mirhome.log
tac /volume1/homes/openhab/userdata/logs/openhab.log | head -n 50 > /volume1/web/openhab.log
date +"%d.%m.%Y %T"
The Rule looks like this:
Time cron “0 34 16 * * ?”
When the rule fires, done with a cron job, i get the following log error:
couldn’t execute commandLine ‘/volume1/homes//openhab/conf/scripts/openhablogs.sh’
If i run this from the CLI: tac /volume1/homes/openhab/userdata/logs/mirhome.log | head -n 10 > /volume1/web/mirhome.log
the command is done.
I tried a lot of possible paths
none is working.
How can i find the right path to fill into the rule?
Any ideas are appreciated
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 ?
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.
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…
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)”