Skip to content

Instantly share code, notes, and snippets.

@codeck
Last active August 29, 2015 14:22
Show Gist options
  • Save codeck/e50e46af880d9fbb7cf3 to your computer and use it in GitHub Desktop.
Save codeck/e50e46af880d9fbb7cf3 to your computer and use it in GitHub Desktop.
A simple poll-based REST API data fetcher script
#!/bin/bash
#
# edit fetsh.lst as a TSV file and press 'q' to stop polling
# poll period: 1 second
#
while [ 1 ]
do
read -t 1 -n 1 char
if [[ $char == 'q' ]]
then
break
else
parallel -j 8 --progress --colsep '\t' -a fetch.lst curl -s {1} -o {2}
git add -A data/
git commit -m "auto message: $(date +%s)"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment