From few days my PC has started twitting ! Ya you heard right my PC is twitting now days. Its really a great thing to get your PC status through twitter . Please note that there may be different method of doing the following . I've dove what I liked. Step First Register a Twitter account for your PC . Step Two Create a shell script for twitter API 😀 [ need curl to be installed on your Linux Box ]

#!/bin/bash curl -u username:password -d status="$*" http://twitter.com/statuses/update.xml

Replace the above user name and password with your own credential Step Three Set a cron job [ cron job will run your script after every specific time ] to set cron job just log into superuser mode and pass following command [ this command checked on Redhat,Fedora Core and Suse]

#crontab -eu root

and after that command add the following lines into your cron job

*/10 * * * * /bin/sh /path/to/your/twitter/script.sh My PC uptime is $(uptime)

If you need any sort of help or to get a customized output please feel free to leave comment and save the cron job and restart the cron job To restart cron job in REDHAT and FEDORA CORE

# service crond restart

For Suse [ I've tested this on suse 11 ]

# service cron restart

So now Your PC will update its status over twitter every 10 mins to change. If your want your PC to send his update every one hour use following

* */1 * * * /bin/sh /path/to/your/twitter/script.sh My PC uptime is $(uptime)

The Following Expectation have been taken from the author to the reader !!!

1)You might be running Fedora , Redhat or Suse [ altough I've not tested on ubuntu / debian the process may be same ]

2)You know basic vi / vim operation !! you need this knowledge to know how to save a file !!

3)you know basic of crontab . BTW if you dont know I will explain it just leave your comments 😀

4)User should not abuse the service of twitter for this !! 😐

5)User Will add a cron job for deleting root mails too or have any other solutions [ you will get a mail in inbox everytime when a cronjob is executed ]

Special Thanks to Anoj Ramaswamy Sundar for http://anojrs.blogspot.com/2008/03/twittering-from-command-line.html This is base of the whole article without which it was not possible to write this article 😀 apart from getting only uptime you can even know your server status 😐

*/10 * * * * /bin/sh /path/to/your/twitter/script.sh $(service mysql status)

above will publish mysql status [ replace mysql with mysqld in fedora and redhat ]

 

UPDATE : Twitter Depriciated basic auth and now use oAuth. Head over here for latest article on this