Help with SMS sending Script

I would like assistance on a script that could send a text message to my mobile phone when I run a command and the text should be send only if a condition is met. I want to have a cron-job running every 10 minutes to check the system for overload conditons with a command:

more logfile.log | grep overloaded | wc -l 

If the output of this command is greater than zero I want an SMS to be send to my mobile number. I would also want to customize the message to read, " Overload on Server 2"

Thanks in advance...

if [ $? -eq 0 ]

Can you elaborate? I am more interested in the code that sends the SMS and how to configure it to send to my mobile number eg +27780008000

Easily You can send email to some SMS gateway

Please elaborate your suggested solution and include how to do it and the associated commands. Thank you

@thinktank

mailx

command can do it if you have access to some SMS gateway otherwise you can look for sms client

$ mailx -s subject phone_number@yourGSMProvider.tld < SMSBody