Setting up Motion with FTP and Email! support
Published: 09-04-2008 | Author: Remy van Elst | Text only version of this article
❗ This post is over thirteen years old. It may no longer be up to date. Opinions may have changed.
I have set up Motion in a way that it Emails me when it detects movement, and it automatically saves the pictures to my FTP server. I do not autostart motion in deamon mode, because it only needs to run while I'm away.
Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.
You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.
It requires little config adaption. First we need to install motion, wput, and sendemail:
sudo apt-get install wput sendemail motion
Motion for the capturing, wput for the ftp-ing and sendemail for the emailing.
Now edit the config file of motion:
sudo gedit /etc/motion/motion.conf
I will list the things i've changed here, my situation is a single USB webcam.
# Start in daemon (background) mode and release terminal (default: off) daemon off # Maximum number of frames to be captured per second. # Valid range: 2-100. Default: 100 (almost no limit). framerate 8 # Number of frames to capture after motion is no longer detected (default: 0) post_capture 5 # Use ffmpeg to encode mpeg movies in realtime (default: off) ffmpeg_cap_new off # Target base directory for pictures and films # Recommended to use absolute path. (Default: current working directory) ## **sudo mkdir /motion && sudo chmod 777 /motion** target_dir /motion # Command to be executed when an event starts. (default: none) # An event starts at first motion detected after a period of no motion defined by gap ## **This is the situation on a Gmail account, just change the CAPS values to yours.** on_event_start sendEmail -f YOURFROMEMAIL@gmail.com -t YOURTOEMAIL@gmail.com -u "SUBJECT" -m "Movement has been detected on: %d %m %Y. The time of the movement was: %H:%M (Hour:Minute). The Pictures have been uploaded to your FTP account." -s smtp.gmail.com:25 -xu YOURGMAIL@gmail.com -xp YOURGMAILPASSWORD # Command to be executed when a picture (.ppm|.jpg) is saved (default: none) # The filename of the picture is appended as an argument for the command. ##**Here also, change the CAPS values to yours** on_picture_save wput ftp://USERNAME:PASSWORD@YOUTFTP.COM %f
This will email and upload the pictures when motion is detected. It works quite good for me.
Note that when you want to put motion on, like when you go to school/work, fire up a terminal:
Or put it in /etc/rc.local for auto start at boot.Tags: email , mail , monitoring , motion , security , tutorials , video , webcam , wput