Hi All,

I was trying to write some shell scripts to do the following job: when
the Streaming API stops working for whatever reason, make a
reconnection immediately. Here is how I did it:

I wrote a script called "check.sh":

c=$(ps aux | grep curl|wc -l)
if [[ "$c" -eq 1 ]] % which means there is no active curl process, the
only live one is "grep"
then
  curl -d @locations http://stream.twitter.com/1/statuses/filter.json -
u username:password >> result.txt
fi

And I created a cron job which runs this "check.sh" every minute:

0-59 0-23 * * * check.sh >> monitor.txt

It does the job partially: it can reconnect to Streaming API in the
case of disconnection. My problem is that, by running this script as a
cron job, the Streaming API got disconnected at the end of every
minute, and then reconnect again at the beginning of the next minute,
and I have no clue why it got disconnected every minute. The problem
seems coming from the cron job I created, but I couldn't find mistakes
there. Does anyone have suggestions on this?

Many thanks for the kind help!
epomqo

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to