Tuesday, July 20, 2010

Along with sending my phone SMS messages I find it useful to have my server twitter me when something noteworthy happens. If you want to do this from the command line easily, just do this.

sudo apt-get install curl

nano ~/bin/filename

curl --basic --user "yourusername:yourpasswd" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null
echo Message Sent!

save it with -o
exit with -x
give it execute permission chmod +x ~/bin/filename

use it like so filename "message"

That was easy!

No comments: