= Send Text Messages (SMS) via your Vodafone/o2 Account =
www.vodafone.ie allows you to send 300 free text messages per month, via their website. Instead of having to logon to their website, vodasms (also called o2sms or meteorsms) has been packaged up, via apt, to allow you to send Text Messages via the linux command line.
vi /etc/apt/sources.list
//Add the following line:
deb http://apt.mackers.com/ unstable contrib
apt-get update
apt-get install o2sms
===== To verify the package signature =====
wget http://www.mackers.com/about/gnupg.key.asc
cat gnupg.key.asc | apt-key add -
Now there wont be any warnings when apt-get updating. With apticron, I was getting annoying daily emails about not verifying the o2sms package signature. Its on the following page if you read closely: http://www.mackers.com/projects/o2sms/docs/v3/install.html
So apt.mackers.com is gone for the past few years. To install it, its a little more complicated as it requires doing a little compiling. (I looked into other ways including cpan -i, however doing a wget and a make is the cleanest). The following was done on a vanilla install of debian squeeze.
mkdir ~/o2sms cd o2sms elinks http://sourceforge.net/projects/o2sms/files/o2sms-3.36.tar.gz/download #Do a Save gunzip o2sms-3.36.tar.gz tar -xvf o2sms-3.36.tar cd o2sms-3.36 #as per http://o2sms.sourceforge.net/install.html perl Makefile.PL #Checking if your kit is complete… #Looks good #Warning: prerequisite Crypt::SSLeay 0 not found. #Warning: prerequisite IO::Socket::SSL 0 not found. #Warning: prerequisite Net::SSLeay 0 not found. #Warning: prerequisite TestGen4Web::Runner 0.11 not found. #Writing Makefile for o2sms
apt-get install libcrypt-ssleay-perl libnet-ssleay-perl libio-socket-ssl-perl
cd ~/o2sms wget http://cpan.mirror.cdnetworks.com/authors/id/M/MA/MACKERS/TestGen4Web-Runner-0.11.tar.gz gunzip TestGen4Web-Runner-0.11.tar.gz tar -xvf TestGen4Web-Runner-0.11.tar cd TestGen4Web-Runner-0.11 perl Makefile.pl #Warning: prerequisite XML::Simple 0 not found.
apt-get install libxml-simple-perl perl Makefile.pl make apt-get install make make make install
With all the prerequisites installed, all is easy. cd ~/o2sms/o2sms-3.36 perl Makefile.pl make make install
Most files are copied to: /usr/local/bin and /usr/local/share/perl/
Refs: <br> http://o2sms.sourceforge.net/install.html <br> http://sourceforge.net/projects/o2sms/forums/forum/917641/topic/3671528 <br> http://blogs.gnome.org/muelli/2009/10/
From the config, this program knows whether to logon to the vodafone.ie, o2sms mkdir ~/.vodasms //for o2, mkdir ~/.o2sms cd .vodasms
vi config //add the following lines username yourmobile_no password yourpassword_to_www.vodafone.ie alias me yourmobile_no //for an alias 'me' alias name mobile_no //optional proxy option: http-proxy http://proxy.server.com:3128
chmod 600 config
vodasms mobile_recipient //type in message here //and here too. //and end the message with CTRL+D
vodasms mobile_recipient -m “type in message here” //Using the above, txts can easily be scripted
Note: If the www.vodafone.ie website is changed, the above script may/maynot work. It should be possible to update the script/utility with apt-get update and apt-get upgrade. Sincere thanks to Mackers.
Reference: http://www.mackers.com/projects/o2sms/docs/v3/install.html
= Forward Emails via SMS Text Message = Using the above vodasms, we can have procmail forward a copy of the email by SMS Text Message. We also use “formail” which should be on most systems by default, to strip out only the bits of the email we require.
You must setup procmail to work. Read procmail for extra information on rules etc. :0 c * ^From: .*nagios@server.com | formail -x Subject: | vodasms your_mobile_no > /dev/null
= Updating vodasms/o2sms 2010 = So it appears that apt.mackers.com is gone and won't be coming back. Until I get the svn method working off sourceforge, a patch was required recently for o2sms. As on the o2sms forum ( http://sourceforge.net/projects/o2sms/forums/forum/917641/topic/3590078 ) a patch was available. wget http://www.mattb.net.nz/patches/o2sms/o2smsaction.diff #patch /usr/share/perl5/WWW/SMS/IE/o2sms.action -i /root/o2smsaction.diff -o /usr/share/perl5/WWW/SMS/IE/o2sms.action-new