About this Script

Weathermessage is a short script I wrote to take full advantage of my free incoming MMS service from US Cellular.

This script takes two arguments from the command line. The first is a 5 digit US zip code (or possibly some other identifier for non-US locations...?). The second is an e-mail address.

The script then downloads an xml file from This XML file is intended to be used by the Forecastfox extension for Firefox.

The script then searches this XML and extracts some useful data and a url to download a small radar image.

Finally, the script takes all of this and formats it into an SMIL message (aka MMS/Cellphone picture message) and sends it via e-mail.

The script depends on the existance of Perl, and the sendmail user binary (or alternate replacement thereof, I use the one provided by postfix). Some other assumptions probably exist about the script running on a Linuxish type system.

If everything worked correctly, you end up with something rather like this on your phone:

Weather From Cedar Rapids, IA
Severe Weather Alert in Effect
Currently: Sunny and 1
Friday: Windy with flurries, 11/-2
Saturday: Intervals of clouds and sun, 4/-9
Sunday: Mostly cloudy and cold, 5/-13

radar image

You might note that it was stupid cold the day I generated this sample. The Severe Weather Alert line refers to a Wind Chill Advisory.

Using the Script

The easiest way to use this script is to simply run it form the command line. The script requires two arguments, first the zip code you want the weather for and second the e-mail address you want the weather report sent to. For example I might log in to my Linux machine and type

$ bin/ 52404

This however, isn't all that useful. If I'm sitting at a computer that allows me to ssh to my linux machine, I could probably just use a web browser to look at the weather report. More useful for me, is to use cron to automatically send the weather report to my phone at times when it's most likely to be useful. To do this, I added a line to my crontab to send a message before I get up in the morning, before I go out for lunch and before I leave work in the afternoon. The line in my crontab looks like this:

30 06,11,15 * * * /home/adam/bin/ 52404

Hopefully, this is useful to someone else. Let me know if it works for you.