Created
September 14, 2011 04:47
-
-
Save freespace/1215873 to your computer and use it in GitHub Desktop.
Downloads webcam images periodically
This file contains 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 | |
if [ $# -ne 2 ]; | |
then | |
echo "Usage: $0 <url> <refresh period>" | |
exit 1; | |
fi | |
URL="$1" | |
INTERVAL="$2" | |
while [ 1 ]; | |
do | |
name=$(date +%Y%m%d-%H%M-%S).jpg | |
curl -s "$URL" -o "$name" | |
if [ $? -eq 0 ]; | |
then | |
echo "downloaded to $name" | |
else | |
echo "curl failed"; | |
exit 2; | |
fi | |
sleep $INTERVAL | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment