I am trying to set up a Raspberry Pi model B+ with PiCamera to be a security camera. Wifi connects to my home network, motion is installed, detecting motion and saving pictures, and I am able to send mail via ssmtp and Google's servers at smtp.google.com:587. You can see my setup here.

The problem is with the on_event_start and on_picture_save triggers, which do not seem to fire. on_event_start executes the command: mail -s "Motion detected" MYEMAILADDRESS </dev/null; that command works fine when I run it by hand, but is not run when motion is detected. on_picture_save executes the command: mpack -s "Patio door" %f [email protected]; that command works fine when I run it by hand, but is not run when a picture is saved. I know the setup is right because I have a working "Front door" security camera that I set up six months ago and it is still working properly.

Can anyone suggest what I might have missed when setting up the new camera?

  • What does the command mail -s "Motion detected" MYEMAILADDRESS actually DO on your system, if you just put it in as a command line? (I'm assuming you have changed MYEMAILADDRESS to something sensible). Jun 17, 2015 at 14:50
  • It sends me an email with an empty body. I forgot the redirection of </dev/null that creates the bulk body.
    – user448810
    Jun 17, 2015 at 16:15
  • I have a similar problem. In my case, on_picture_save works but on_event_start doesn't...
    – clemtoy
    Sep 23, 2015 at 13:25
  • @SteveRobillard Well it seems it's a bug as you can see in this
    – clemtoy
    Sep 23, 2015 at 16:04
  • @clemtoy thanks for the quick response. I am going to leave the edit since user448810 is OK with it. I am also going to clean up the comment thread. Sep 23, 2015 at 16:13

1 Answer 1


I would test this by putting a simpler command in place of the mail & mpack commands - why not change the line to this:

on_event_start : >~/Trigger1 # this just creates an empty file   
on_picture_save : >~/Trigger2  

and see if these 2 files are generated when an event fires off?

Then you can test the actual real commands, by typing them into terminal, and see if a file does actually get sent; then copy the working line into the config file.

  • I've already tested the actual real commands. They work fine from the command line. I suspect some permission issue that prevents motion from running the command.
    – user448810
    Jun 17, 2015 at 16:18

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.