Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############## START CONFIGURATION ###############
- ###############################################
- #IMAGE SETTINGS
- ARGS="-vf -hf -w 1024 -h 720 -q 50 -n -ex auto"
- TEXT_TOPLEFT=" Raspbery Pi Camera Script"
- TEXT_TOPRIGHT="Date: ${dateTaken} "
- TEXT_BOTTOMLEFT="http://XXXXXXXXXXXXXXX.it"
- TEXT_BOTTOMRIGHT="(c) MyName "
- LOGO_TOPRIGHT="/home/pi/images/logo.jpg"
- #FTP SETTINGS
- HOST="62.149.142.XXX"
- USER="XXXXXX@aruba.it"
- PASS="xxxxxxxx"
- DIR="/www.trovaXXXXXXXXXXXX.it/dati/"
- #DATE AND LOG
- dateTaken=$(date "+%d/%m/%Y - %H:%M")
- now=$(date "+%H%M")
- today=$(date "+%d%m%Y")
- logfile="/home/pi/images/webcam_$today.log"
- ###############################################
- ############## END CONFIGURATION #################
- ###############################################
- cd /home/pi/images
- echo "###################################" >> $logfile
- echo "starting script $dateTaken" >> $logfile
- echo "Taking a Picture" >> $logfile
- /opt/vc/bin/raspistill $ARGS -o /home/pi/images/image.jpg >> $logfile
- echo "Convert and add overlays" >> $logfile
- /usr/bin/convert /home/pi/images/image.jpg \
- -gravity NorthWest -background Blue -splice 0x18 -pointsize
- 15 -fill yellow -annotate 0 '${TEXT_TOPLEFT}' \
- -gravity NorthEast -fill yellow -annotate +0+0 '${TEXT_TOPRIGHT}' \
- -gravity SouthWest -background Blue -splice 0x18 -pointsize
- 12 -fill yellow -annotate 0 '${TEXT_BOTTOMLEFT}' \
- -gravity SouthEast -fill yellow -annotate +0+0 '${TEXT_BOTTOMRIGHT}' \
- -gravity NorthEast $LOGO_TOPRIGHT -geometry +5+19 -composite \
- /home/pi/images/image_$now.jpg >> $logfile 2>&1
- cputemp=$(/opt/vc/bin/vcgencmd measure_temp)
- myip=$(curl --connect-timeout 30 http://ifconfig.me/ip)
- uptime=$(uptime)
- echo "LastUpdate: $dateTaken | CPU $cputemp | IP: $myip | uptime:
- $uptime" > /home/pi/images/status.txt
- echo "Upload image_$now.jpg to FTP" >> $logfile
- # Start the FTP client
- ftp -inv $HOST << EOF >> $logfile
- user $USER $PASS
- cd $DIR
- put image_$now.jpg
- put status.txt
- bye
- EOF
- echo "Remove image_$now.jpg" >> $logfile
- rm -f /home/pi/images/image_$now.jpg
- echo "Ok"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement