Skip to content

Instantly share code, notes, and snippets.

@freespace

freespace/scrape.sh

Created Sep 14, 2011
Embed
What would you like to do?
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