Automatic Twitter update via bash script and cron..

hehe.. tweet..=~ twitter.com

create a shell script (go_tweet) with following content..


date=`date`;
msg="$1 as of $date"
curl --basic --user "username:password" \
--data-ascii "status=`perl -MURI::Escape -e \
"print uri_escape('$msg');"`" \
http://twitter.com/statuses/update.json

Replace the username:password with your tweet account ..
It is recommended to register a new one for this purpose only if security is your major concern.


put somewhere is /usr/local/bin/ or somewhere that you remember..

chmod a+x /usr/local/bin/go_tweet

then.. to update.. just need to run..

/usr/local/bin/go_tweet "your message here.."
<code>

for auto update every hour ..
<code>
crontab -e

add a line to post uptime output each time..


5 * * * * /usr/local/bin/go_tweet `uptime`

else you can modify it to suit whatever message that you might want to post..

if want to lock twitter to be followed / seen by approved personal only ..
go to home Twitter -> Settings.

tick the Protect update.
protect1

and each user that want to follow your update will have to request.. and to be approved you before they can see the update.

request_sent

p/s : might be useful during content filtering of “Silly Season” soon.. fetching needed RSS / news update only..

my twitter is now feeding live example of weather forecast for every 12 hour.. http://twitter.com/klweather .. any other ideas to be added ?

for this blog feed only is at http://twitter.com/namrannet