Sunday, May 16, 2010

Tweeting From My Bash Shell

Recently i treid this from a bash command prompt to update my tweeter status -


And see i did it recently successfully..
-Follow me here @ http://twitter.com/debajitkataki

Now this tweet can be a all time favorite for some tweeter crazy system admin to inform you something by integrating this with a linux shell script!

An Example:

#!/bin/bash
load=`awk -F "." '{print $1}' /proc/loadavg`
report=report.txt
mailid="debajit.kataki@gmail.com,techops@<>.com"
if [ $load -ge 10]
then
echo "Warning:: Server load is above 10!! Please look into" >>$report
echo -e "....and current memusage is: \n" >>$report
cat /proc/meminfo | head -n 2 >>$report
mail -s "Warning:: SSO server Load" $mailid < $report elif [ $load -ge 16 ] then echo "Critical: Server load is above 16!! Please look into" >>$report
echo -e "....and current memusage is: \n" >>$report
cat /proc/meminfo | head -n 2 >>$report
mail -s "Critical: SSO Load" $mailid < $report

## Using Curl to update tweeter status
curl -u debajitkataki@gmail.com:bombasticpassword -d status="Dear debu's Follower, Can some one please inform debu to check his email, as one of his server is dieing badly... " http://twitter.com/statuses/update.xml > /dev/null

## End of tweeter update

fi

Am i exploiting tweeter here ;-) I guess Nope! Probably the right attitude and spirit of online collaboration..

Cheers!

DEBU

No comments:

Post a Comment

AWS re:Invent summary 2017

As you might know, this year’s AWS re:Invent was held @ Las Vegas 11/27 – 12/1.   Below links could be a good start to explore all ...