motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.93k stars 652 forks source link

Execute Script after detecting Motion #1364

Open RobN007 opened 5 years ago

RobN007 commented 5 years ago

Preliminary Docs I confirm that I have read the CONTRIBUTING guide before opening this issue. I confirm that I have read the FAQ before opening this issue.

0.40 motionEyeOS Version 4.0 Motion Version 9.9 Raspian (Stretched) Raspberry Pi 3 (B+) Board Model Raspberry Pi V2.1 Camera

Hello, I want to run a command after a Motion is detected. After reading a lot of differet issues i know that the file should be stored in /data/etc/example.sh Unfortunatly i dont have this Directory.

The motioneye.conf file is saved in /etc/motioneye .

Issue1

Ive installed motioneye os on my Raspberry pi (Raspberry 9.9 Stretched)

I tried putting different paths in to the Run a Command field but the script was never executed even though a Motion was detected and the script is doing its job after executed in the terminal.

Issue2

(The file was made executable with chmod +x)

Anybody knows where I need to save the script or something else to solve my problem?

RobN007 commented 5 years ago

Issue3

Is it even trying to run the command after detecting Motion?

Pi-DD commented 5 years ago

I wanted to do the same thing, and agree the wiki is unclear, referring to "stored in /data/etc/example.sh".

However, I've managed to make it work OK, running a command both when motion is detected and when the video file creation is completed, by putting my bash script in /etc/motioneye/ just as you did. I am running all the same software levels as you - except you mention that you are running motioneyeos, I am running motioneye on Raspbian Stretch. Do you mean MotionEyeOS?

My command script is executable by anyone, in case that is relevant.

Looking at your log files there seem to be errors to do with config items not being recognised etc. Stupid question, but perhaps it is never getting to the point of detecting motion because it's not recognising the camera properly?

If you turn off the command, do you get still/video actually recorded when motion is detected? If you turn on "show frame changes" do you see that change when you move in front of the camera?