0

I'm trying to get Motion to trigger gphoto2 with on_motion_detected.

I can get this event to run a bash script, I can get it to run a python script. If either of those calls gphoto2 it fails.

Running the bash scrip or python script from the command line works. So the problem is probably something that is too in the weeds for me to figure out. Over on Reddit, a user with a similar problem found a solution by adding Motion as a user to the plugdev group. I tried that, but it didn't work for me.

https://www.reddit.com/r/raspberry_pi/comments/cqnuqh/help_gphoto2_and_motion_as_camera_trigger/

in motion.conf:

on_motion_detected /bin/bash /home/pi/Scripts/script.sh

and the script:

#!/bin/bash
gphoto2 --capture-image

Motion is using a Raspberry Pi Camera Module 2, and I'm trying to trigger a Sony A7Rii with gphoto2. Again, each works on its own separately, just not together.

John
  • 11
  • 2
  • What do your error logs, or root mail say? – Zak Dec 15 '21 at 20:49
  • Can you verify that your script is, in fact running? Putting something else in the script like `echo "Testing" > /home/pi/Scripts/test.txt` will help verify that. Also, is your scripts folder actually capitalized in the directory? `Scripts` and `scripts` are two different directories as far as Linux is concerned. – Zak Dec 15 '21 at 21:14
  • You may want to check out https://raspberrypi.stackexchange.com/ as well. – James Brown Dec 16 '21 at 05:01
  • Thanks, @Zak I'll check the error logs. The script is running, both a bash and python script can create a directory, for example, it just can't trigger gphoto2. If I run the same script from the command line, it works, so there isn't a problem with motion triggering a script or with the script used to trigger gphoto2. – John Dec 17 '21 at 21:26
  • Also make sure the user "running" `motion.conf` has permissions to run the `gphoto2` command – Zak Dec 17 '21 at 23:20

0 Answers0