Daily Links Automated

As can be seen from the previous post I’m back!

The best bit is that post was created automatically. I use del.icio.us to bookmark interesting things I read day to day. It has support for daily links posted to your blog but that requires XML-RPC support which Blosxom doesn’t have out of the box.

So I wrote a small perl script which downloads links daily and creates a post if there are any for that day. Most of the heavy lifting is done by Net::Delicious (which I turned into a deb package for Ubuntu Hardy) and to save time a lot of inspiration was drawn from Edward de Leau’s WordPress script.

Final problem. I want it to run at midnight UTC (del.icio.us’ “get by date” API works in UTC) in order to grab all the links for an entire day when they are fresh, fresh, fresh. But how do you run this out of CRON on a system that is in timezone “Australia/Sydney” with all it’s daylight savings fun, fun, fun?

# Only want this to run just before midnight GMT
59 9 * * * /bin/date +\%z | /bin/grep -q 1000 && /path/to/delicious2blosxom.pl
59 10 * * * /bin/date +\%z | /bin/grep -q 1100 && /path/to/delicious2blosxom.pl

Run it twice a day but check for the current UTC offset first. The first covers normal Sydney time, the second daylight savings. Sweet!

This entry was posted in Daily Links, Internet, Tech and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.