Code: Select all
#!/bin/bash
#Get last 24hrs of jpgs from zm events
find /var/www/html/zm/events/1/ *.jpg -ctime -1 -exec cp --parent {} /some/temp/folder \;
#Take the event id and append it to the file name
for directory in `ls /some/temp/folder/var/www/html/zm/events/1`
do for each in `ls /some/temp/folder/var/www/html/zm/events/1/$directory`
do mv -v /some/temp/folder/var/www/html/zm/events/1/$directory/$each /some/temp/folder/zm-event/$directory-$each
done
done
#Delete unwanted analsed jpg files
rm -rfv /some/temp/folder/zm-event/*analyse.jpg
#change directory
cd /some/temp/folder/zm-event
#Encode into an avi
mencoder "mf://*.jpg" -mf fps=15 -o last24hrs.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=400
#Remove jpgs from zm-event directory
rm -rf /some/temp/folder/zm-event/*.jpg
#Email avi to email address
nail -v -s "Zone Minder" -a /some/temp/folder/zm-event/last24hrs.avi your.email@address.com < /dev/null
Ok the /some/temp/folder needs to be made and the /some/temp/folder/zm-event
mplayer needs to be installed, to get mencoder.
nail needs to be install and /etc/nail.rc needs to be edited and add the line
set smtp=smtp.your-isp.mail.box
then i crontab'd it to run every 24hrs
as root
crontab -e
add the line
00 4 * * * /location/of/bash-script.sh
runs it at 4am
That should do it.
Hope this is useful, and not already done