Created
May 19, 2015 20:04
-
-
Save mikebridge/1b96a1984b64fb41f5db to your computer and use it in GitHub Desktop.
take a photo on raspberry pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PIDMOTION=$(pgrep -x motion) | |
| if [ -n "$PIDMOTION" ] | |
| then | |
| echo "stopping motion" | |
| sudo /etc/init.d/motion stop | |
| fi | |
| TIMESTAMP=$(date -d "today" +"%Y-%m-%d-%H%M").jpg | |
| FILENAME=/home/pi/motion/photo-$TIMESTAMP | |
| WIDTH=1900 | |
| HEIGHT=1425 | |
| #QUALITY=50 | |
| QUALITY=8 | |
| EXPOSURE=auto | |
| #EXPOSURE=night | |
| #EXPOSURE=verylong | |
| echo "taking photo..." | |
| /usr/bin/raspistill --exposure $EXPOSURE --quality $QUALITY --width $WIDTH --height $HEIGHT -o $FILENAME | |
| if [ -n "$PIDMOTION" ] | |
| then | |
| echo "restarting motion" | |
| sudo /etc/init.d/motion start | |
| fi | |
| rsync --remove-source-files -avzhe "ssh -i /home/pi/.ssh/id_rsa" $FILENAME [email protected]:/root/webcam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment