-rwxr-xr-x 1 openhabian openhabian 569 Feb 4 20:37 logviewer.sh
If i call the script in the shell everything runs well and the âevents.htmlâ is written.
But not automaticly by Openhab like the definition in the thing.
If have four more other shell scripts, they are defined in the same way⌠they work without any problems.
Can somebody guess whats the problem is caused by ?
Thing exec:command:logviewer [command="/etc/openhab2/scripts/./logviewer.sh", interval=60, timeout=5, autorun=true] //Logviewer fĂźr die Sitemap
no effect
Dont reload⌠i must say no load at all.
I does nothing. Except i run the script direct from the shell.
Can i run the script with a rule ?
Like⌠when time cronâŚ
then run scriptâŚ
?
yes i can run it like that:
/etc/openhab2/scripts/./logviewer.sh and events.html gets written
or i can run it like that:
/etc/openhab2/scripts/logviewer.sh and events.html gets also written
one step closer:
that comes up in the log when OH try to write the events.html
2020-02-05 19:33:55.233 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.items'
==> /var/log/openhab2/events.log <==
2020-02-05 19:33:55.279 [.ItemChannelLinkAddedEvent] - Link 'BefehlOutput-exec:command:logviewer:output' has been added.
2020-02-05 19:33:55.287 [.ItemChannelLinkAddedEvent] - Link 'BefehlInput-exec:command:logviewer:input' has been added.
2020-02-05 19:33:55.294 [.ItemChannelLinkAddedEvent] - Link 'BefehlExit-exec:command:logviewer:exit' has been added.
2020-02-05 19:33:55.301 [.ItemChannelLinkAddedEvent] - Link 'BefehlRun-exec:command:logviewer:run' has been added.
2020-02-05 19:33:55.306 [.ItemChannelLinkAddedEvent] - Link 'BefehlLastexecution-exec:command:logviewer:lastexecution' has been added.
2020-02-05 19:33:59.660 [vent.ItemStateChangedEvent] - BefehlRun changed from NULL to ON
2020-02-05 19:33:59.702 [vent.ItemStateChangedEvent] - BefehlRun changed from ON to OFF
2020-02-05 19:33:59.716 [vent.ItemStateChangedEvent] - BefehlExit changed from NULL to 1
2020-02-05 19:33:59.733 [vent.ItemStateChangedEvent] - BefehlOutput changed from NULL to /etc/openhab2/scripts/logviewer.sh: Zeile 3: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 5: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 6: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 7: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 8: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 9: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 10: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 11: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 12: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 3: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 5: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 6: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 7: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 8: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 9: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 10: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 11: /etc/openhab2/html/events.html: Keine Berechtigung
/etc/openhab2/scripts/logviewer.sh: Zeile 12: /etc/openhab2/html/events.html: Keine Berechtigung
2020-02-05 19:33:59.738 [vent.ItemStateChangedEvent] - BefehlLastexecution changed from NULL to 2020-02-05T19:33:59.710+0100
I donât speak German but Iâm going to guess that the error means the openhab user doesnât have permission two write to /etc/openhab2/html/events.html, which would be unusual but not impossible. As I asked previously, does it run as the openhab user? The errors indicate that it doesnât, there is some sort of permission problem.
Itâs not the scriptâs ownership thatâs a problem. Everyone has permission to run it. But the openhab user has to have permission to do everything that the script itself does. The error indicates that it doesnât. I canât call that command or it canât write to the file or it canât read the file or something.
I donât know what the openhab user doesnât have permission to do. But it doesnât have permission to do something that the script does. You need to run the script as the openhab user and see what itâs doing that it doesnât have the permission to do.
ok, now i am getting close to my knowledge boarder about linux
i guess the openhab user is âopenhabâ right ?
and then i have to change the ownership of the script to âopenhabâ ?
ok Folks i got it!
It was as problem with the right of the written events.html
My fault was:
After i created the script i tested it from the shell, so there iam âopenhabianâ user
But OpenHab is âopenhabâ user and therefore âopenhabâ can overwrite the file.
before it was openhabian.openhabian so openhab can´t write it
so i have to change it with
chown openhab events.html
to:
-rw-r--r-- 1 openhab openhabian 12420 Feb 5 20:31 events.html