Twurl with statuses/filter time limit


I have an Amazon EC2 instance running and use twurl to connect to the Twitter /statuses/filter.json streaming API to collect various sporting tweets.

It all works pretty nicely to be honest, but as a novice I cannot for the life of me figure out how to only run the process for say 1000 tweets, or 5 minutes at a time.

In the Ubuntu terminal, I run the following command:

sudo bash

Which calls the bash script containing the following code:

twurl -t -d track=NHL language=en -H /1.1/statuses/filter.json > tweets.json

If I manually end the process by pressing CTRL+C, this works perfectly. However, what I would really like is to be able to collect 100 tweets at certain points of the day. Any ideas how I may build this in? I’ve Googled it but have so far come up short…


How about just using a cron job to run your script at particular times of the day, and then kill it?


Hi Andy! That’s what I was planning on doing, but I can’t work out how to kill the script once it’s been started.


Have worked it out!

Ended up being massively simple:

timeout 5m bash