Advertisement
Guest User

Untitled

a guest
Aug 26th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. ############## START CONFIGURATION ###############
  2. ###############################################
  3.  
  4. #IMAGE SETTINGS
  5. ARGS="-vf -hf -w 1024 -h 720 -q 50 -n -ex auto"
  6. TEXT_TOPLEFT=" Raspbery Pi Camera Script"
  7. TEXT_TOPRIGHT="Date: ${dateTaken} "
  8. TEXT_BOTTOMLEFT="http://XXXXXXXXXXXXXXX.it"
  9. TEXT_BOTTOMRIGHT="(c) MyName "
  10. LOGO_TOPRIGHT="/home/pi/images/logo.jpg"
  11.  
  12. #FTP SETTINGS
  13. HOST="62.149.142.XXX"
  14. USER="XXXXXX@aruba.it"
  15. PASS="xxxxxxxx"
  16. DIR="/www.trovaXXXXXXXXXXXX.it/dati/"
  17.  
  18. #DATE AND LOG
  19. dateTaken=$(date "+%d/%m/%Y - %H:%M")
  20. now=$(date "+%H%M")
  21. today=$(date "+%d%m%Y")
  22. logfile="/home/pi/images/webcam_$today.log"
  23.  
  24. ###############################################
  25. ############## END CONFIGURATION #################
  26. ###############################################
  27.  
  28. cd /home/pi/images
  29. echo "###################################" >> $logfile
  30. echo "starting script $dateTaken" >> $logfile
  31. echo "Taking a Picture" >> $logfile
  32.  
  33. /opt/vc/bin/raspistill $ARGS -o /home/pi/images/image.jpg >> $logfile
  34.  
  35. echo "Convert and add overlays" >> $logfile
  36.  
  37. /usr/bin/convert /home/pi/images/image.jpg \
  38. -gravity NorthWest -background Blue -splice 0x18 -pointsize
  39. 15 -fill yellow -annotate 0 '${TEXT_TOPLEFT}' \
  40. -gravity NorthEast -fill yellow -annotate +0+0 '${TEXT_TOPRIGHT}' \
  41. -gravity SouthWest -background Blue -splice 0x18 -pointsize
  42. 12 -fill yellow -annotate 0 '${TEXT_BOTTOMLEFT}' \
  43. -gravity SouthEast -fill yellow -annotate +0+0 '${TEXT_BOTTOMRIGHT}' \
  44. -gravity NorthEast $LOGO_TOPRIGHT -geometry +5+19 -composite \
  45. /home/pi/images/image_$now.jpg >> $logfile 2>&1
  46.  
  47. cputemp=$(/opt/vc/bin/vcgencmd measure_temp)
  48. myip=$(curl --connect-timeout 30 http://ifconfig.me/ip)
  49. uptime=$(uptime)
  50. echo "LastUpdate: $dateTaken | CPU $cputemp | IP: $myip | uptime:
  51. $uptime" > /home/pi/images/status.txt
  52.  
  53. echo "Upload image_$now.jpg to FTP" >> $logfile
  54.  
  55. # Start the FTP client
  56.  
  57. ftp -inv $HOST << EOF >> $logfile
  58. user $USER $PASS
  59. cd $DIR
  60. put image_$now.jpg
  61. put status.txt
  62. bye
  63. EOF
  64. echo "Remove image_$now.jpg" >> $logfile
  65. rm -f /home/pi/images/image_$now.jpg
  66. echo "Ok"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement