Skip to content

Instantly share code, notes, and snippets.

@freespace
Created September 14, 2011 04:47
Show Gist options
  • Save freespace/1215873 to your computer and use it in GitHub Desktop.
Save freespace/1215873 to your computer and use it in GitHub Desktop.
Downloads webcam images periodically
#!/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