I would like to query some help on a problem that i am facing. I would first advise that I am really new on Domoticz and honestly not so much experimented on *nix families. So my issue might be quite boring for some of you (or even worse, the explanation on how to solve it)
Here i am using Domoticz on a Rpi3 (under RaspBian).
Goal of the script: I would like to capture a video (from a webcam) when a door is opened. To do that, I aim to use "streamer" which seems to work (well i still have to dig on streamer option, because i am not yet satisfied of the size of the captured video, or use ffmepg after the capture).
I have a sensor which indicates when the door is open: the signal is send periodically (let say each second). So, I created a switch that have a 2 seconds to be "off" (sorry i don't remember exactly the terminology used ).
On the "action ON" of the switch I want to start the capture, and stop it on the "action OFF". So, I put the call to the script with the expected parameter (ON or OFF) in the corresponding action fields.
As I expected Domoticz to "re-launch" each time the script at each sensor message "Door Open", I tried to solve it either putting the "streamer" in background, either using the "start-stop-daemon" command.
But unfortunately, it doesn't work as expected: I can see that a video file is being processed, and another etc... It seems that the "streamer" task is "killed?" and as the sensor is keeping sending the information, a new "streamer task" is restarted... I tried to watch the PID of streamer (with pgrep) and I can confirm that the PID changes (so it's not the "same task")
May I ask for some help here to indicate me if my script is wrong and how to correct it ?
I attach here two versions: the first one, which was "simple", but as I suspected Domoticz to stop the "shell used to start the script" I tried another one with the "start-stop-daemon" (I also tried to launch a batch to "double fork, but I am not sure of that was the good way to do that, and it doesn't worked at all)...
I have to say that here I am quite stuck and missing ideas for possible workarounds , so any advise would be welcomed…
Thanks in advance for any help or clues