I am using Motion to record videos.
I have a Python script which sends the video to me when it ends (sendvideo.py).
I have a bash script that clears the folder (clearmedia.sh)
I have tried the following:
on_movie_end sudo python /home/pi/Motion/sendvideo.py && bash clearmedia.sh
The clearmedia.sh file is simple:
#! /bin/bash/ sleep 50s rm -f /home/pi/Motion/media/*
The reason for the sleep is because the video is created using the images that are collected by Motion.
When I use sleep the script fails to run.
When I remove sleep the script runs but the video wont work because the contents of my media folder is cleared before it has a chance to email me the video.
Is there a way to getting this to work? I could stick the bash script in the on_event_end section of the motion.conf file but I would like it to work after the movie ends and the email is sent.
This is the final step in getting my pi home security system to work. I just need to avoid my Pi filling up with loads of files. I don't mind my email filling up as that is the point of this experiment!