I am using Raspbian Jessie and I am trying to run a simple buzzer Python script when Motion detects movement. When I run the Python script in terminal it runs fine and I can hear the buzzer output.

This is what I have set in the motion.conf file:

on_event_start python /etc/motion/buzzer.py

I have also tried a bash script but with no success.

I have also ensured that I have made the Python script executable. For reference these are the current permissions set:

-rwxr-xr-x 1 motion motion   336 Apr  2 04:51 buzzer.py
-rwxr-xr-x 1 motion motion    36 Apr  2 06:26 buzzer.sh
-rwxrwxrwx 1 root   root   27758 Apr  2 06:25 motion.conf
  • Welcome to RPi board. Can you edit your post and add sh files inside too ?
    – ahmetertem
    Apr 2, 2016 at 11:56
  • Try putting quotes around the command, like this "python /etc/motion/buzzer.py" Apr 2, 2016 at 12:12
  • I also had the same issue last week, and it turned out I had failed to remove the ; at the beginning of the line. Apr 2, 2016 at 12:13

1 Answer 1


Thanks guys, I managed to figure out the issue.

In the end it was a permissions issue, Motion uses it's own user motion to access the script and the directory so it is important to make sure all permissions of the relevant directory, scripts allow access. I created a new directory in the root directory and changed the owner and group to motion, I did the same for the Python script.
I tested other scripts and it was working fine but my buzzer Python script was still not running.

I read in some forums that only root user can access the GPIO pins to output the buzzer. This is the forum I read on the topic:

Access GPIO as non-root

I checked the udev rules, see the posted answer in the link above. I then added the motion user to the gpio group.

sudo adduser motion gpio

From there I changed the owner to motion and the group to gpio for the Python script. The Python script is now working great with Motion!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.