Last active
August 29, 2015 14:08
-
-
Save ryo1kato/e58b4bb2b566008f7305 to your computer and use it in GitHub Desktop.
surveillanceCamera.sh - script to save pics from web-cam priodically
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 | |
| # | |
| # http://iharder.sourceforge.net/current/macosx/imagesnap/ | |
| # | |
| normal_interval_sec=30 | |
| cloud_interval=4 | |
| save="$HOME/usr/var/SurCam" | |
| save_cloud="$HOME/Dropbox/SurCam" | |
| mkdir -p "$save" | |
| mkdir -p "$save_cloud" | |
| cd "$save" | |
| count=0 | |
| while sleep $normal_interval_sec | |
| do | |
| filename="$PWD/$(date +%FT%T).jpg" | |
| imagesnap "$filename" | |
| if (( count++ % cloud_interval == 0 )) | |
| then | |
| echo "Save to cloud: $filename" | |
| ( cd "$save_cloud" && ln -s "$filename" ./ ) | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment