Example of automated video email?
Could a bash cowboy/cowgirl, please review my code below and provide guidance/corrections? I am following the instructions from elinux, but email notification section is sparse on details or an example.
I have the RPi Cam Web up and working. I installed, configured and verified that ssmtp and mpack are able to send emails/attachments from pi@raspberrypi prompt.
I need a second set of eyes or someone to verify this is will send a thumbnail once the video is written:
1. nano /var/www/macros/end_vid.sh
2. add:
!/bin/bash
list=( $1*.th.jpg )
thumb="${list[-1]}"
mpack -s "Motion Detected" /var/www/media/thumb
mail.address@example.com
^---- is this right? thumb or should it be $thumb
[save and exit nano]
3. sudo chmod a+x /var/www/macros/end_vid.sh
4. sudo chown www-data:www-data /var/www/macros/end_vid.sh
Does this look correct? is there a more elegant way or method that I overlooked?
Guidance and help are appreciated! thank you!