- Hardware: Raspberry Pi 3
- OS: Linux openHABianPi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l
- Java Runtime Environment: openjdk version “1.8.0_152”
- openHAB version:2.4.0-1 (Release Build)
Issue of the topic:
As a complete newcomer, I tried to write my first rule. Under /etc/openhab2/rules/default.rules I have
rule "Algu ha entrat" when Item Porta_terrassa changed from CLOSED to OPEN then executeCommandLine("/home/openhabian/scripts/portaoberta.sh") end
The script does nothing else but to add a timestamp in a log file:
#!/bin/bash echo "Door opened at $(date)" >> /home/openhabian/scripts/log
If I run the script on the command line it does what it should.
Looking at the logs I see:
2019-02-24 18:51:42.567 [vent.ItemStateChangedEvent] - Porta_terrassa changed from CLOSED to OPEN 2019-02-24 18:51:42.620 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine '/home/openhabian/scripts/portaoberta.sh'
But I do not see any update in the log file… unless I do
chmod a+rw log
My question is: under which user/group is the command line issued? I would prefer the log file to just have the necessary permissions and nothing more.
Thanks in advance!