OpenWRT Logging via Twitter
This won’t work anymore, digest auth is not supported by twitter so see the solution by lostman to get OAuth-capable client!
Update: On Oct 29 2011 I have shut down the twitter account. Here’s how it looked like:
Have you ever thought of your router twitting status updates? E.g. if the connection goes down and comes back you are notified right away in a light-weight fashion.
Never?
Nevermind, here’s how to do that:
Create an account on twitter.
-
Create a Basic authentication string with
-
Use the following shell script, substituting $base64string with the string obtained in previous step:
#!/bin/sh TWEET="status=$*" CONTENT_LENGTH=`echo -n $TWEET | wc -c` MESSAGE=" POST /statuses/update.xml HTTP/1.1 Host: twitter.com User-Agent: OpenWRT Twitter Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Length: $CONTENT_LENGTH Authorization: Basic $base64string $TWEET" echo "$MESSAGE" | telnet twitter.com 80 > /dev/null 2>/dev/null
Save it as /usr/bin/tweet and start using it right away.
Set up some cron job, make it log something and... follow your router :)
You can follow my router, just in case :)