Today Ubuntu 10.10 was released, at 10:10am. Last night I prepared my laptop for a complete reinstall, I took a backup of everything important from both Ubuntu and Windows, and prepared GParted and Windows 7 CD’s.
This took a while, so it was late when I went to bed. That left me with a conundrum, I wanted to install Ubuntu as soon as it came out, but I also wanted to sleep… Hmm..
The solution? I wrote a script. The new Ubuntu release is immediately announced on the Ubuntu Release Blog as soon as it propagates through the mirrors.
So, I wrote a shell script to run on the CompSoc servers that wget’s the Ubuntu Release blog RSS every minute, computes an MD5 sum of the page and checks has it changed. Since the next post to be published would be the release post, I would know immediately when the release was official.
To alert my sleeping self to this fact, I had the script send a text message to my phone using the meteorsms program when it detected that the post was up.
I then set my text ringtone to be something particularly loud and irritating so as to wake me.
I knocked this together in about 5 minutes, so I was pretty surprised when, at 11.37, exactly 1 minute after the blog updated, I got the following text.
Immediate Ubuntu plus a Sunday morning lie in. Success.
Code for the script below and it can be downloaded at this link
#!bin/bash #Delete any previous dw's rm index.html?feed=rss2 #Get file wget -q http://release-blog.ubuntu.com/?feed=rss2 #Compute first sum oldsum=$(md5sum index.html?feed=rss2) #Infinite while loop while true; do rm index.html?feed=rss2 wget -q http://release-blog.ubuntu.com/?feed=rss2 #Compute new sum newsum=$(md5sum index.html?feed=rss2) if [ "$oldsum" != "$newsum" ] then echo $oldsum echo "changed to;" echo $newsum echo "at" date #Send text message meteorsms -m "Ubuntu out!!" me exit fi #If md5s are the same, sleep for a minute and try again sleep 60 done