Hi,
@McJohn
@waaren
I followed your post here and I was hoping that somebody would discover a magic solution.
In my opinion scripting in Domoticz is a pain in the A$$, to keep it polite.
See also my post at:
https://www.domoticz.com/forum/viewtopi ... pt#p249275
I tried to avoid it. See also:
https://www.domoticz.com/forum/viewtopi ... 07#p231907
1. I do not believe that the platform or the Linux (Debian or Raspbian) is the root cause.
Currently I run on
pi@RPi1:~ $ uname -a
Linux RPi1.jonasnet.nl 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux
I created a virtual switch, which triggers a script.
The script is in ~/domoticz/scripts directory.
pi@RPi1:~ $ ls -l domoticz/scripts/test.sh
-rwxr-xr-x 1 pi pi 161 Jun 11 14:42 domoticz/scripts/test.sh
The contents of the script is as follows:
Code: Select all
#!/bin/sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/test.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") test | tee -a $LOGFILE
echo $(date) test > ~/canBeRemoved_$$
The last line is the code is what @waaren suggested.
If the script is activated a log file is created in the /home/pi directory and owned by root:root
The contents is as follows:
2020-06-11 15:18:29 test
You would expect that @waarens last line is executed and that you will find that file in the /root directory.
No it is not created, however if you run the same script from the command line, it is created in the /home/pi directory and owned by pi.
That makes sense.
I still try to find the root cause of this behavior,
Regards