I have to inform you that there will be no Editorial Echoes today, for the same reason that there has been no new posts on this blog over the last 24 hours…hayfever, and a rather nasty dose of it too!
There was really no point in me trying to record a podcast with a blocked nose and a sore throat, and as I spent most of the day asleep anyway, I didn’t have much to talk about. I am feeling better now, and will have to travel out to Bruce today to hand in an assignment which was due yesterday, the same one I nearly handed in last week  (and to the person who emailed me with a non-working email address, no it wasn’t Requirements Analysis, it was Client Support).
Anyway, I will take this opportunity to explain the automation which is enabling you to receive Editorial Echoes each morning at 6am, even though I may still be asleep.
The night before the episode goes online I do a quick bit of editing (noise reduction and adding in the music) before saving the MP3 and uploading it. I also write the update for the RSS feed, and the sidebar listing, these also get uploaded.
Before I go any further, I should explain a thing or two about the directory structure of this website. This website is hosted on Bluehost ‘s “Box 35” along with many other websites. On that server, I have a directory located at /home/samuelgo/ this is my “home directory” and is effectively my root directory (aka my / directory)thanks to the use of a “chroot jail”. (It is worthwhile pointing out that the server is Linux based, and you can type those terms into Google for more info).
Everything you see on this website is located in my /public_html/ directory, which is effectively the / directory of the website (aka the http://samuelgordonstewart.com/). (Technically most of this site is generated dynamically by pulling stuff out of a database, and most of the URLs don’t physically exist but are understood by the server with the help of some modrewrite rules in the .htaccess file.)
OK, if I were to upload these files straight into the Editorial Echoes directory (/public_html/wp-content/EditorialEchoes/) it would be possible for people to download them earlier than the release date, and would result in podcast software downloading it very early, so a bit of automation and trickyness is necessary.
Instead of uploading the files to the public Editorial Echoes directory, I upload them to a hidden Editorial Echoes directory outside of the /public_html/ directory, and effectively not accessable by the public. This directory is the /echoes/ directory.
As I said, that file isn’t publically accessable, so that doesn’t really solve anything as there’s no point having a podcast that people can’t download…that’s where the automation kicks in. I have a couple cron jobs (cron being the Linux task scheduling program) set up to automatically copy the various files to their public locations. These three files are
- The updated sidebar
- The updated RSS feed
- The MP3 file
The cron jobs look like this:
55 11 * * * mv /home/samuelgo/echoes/echo*.mp3 /home/samuelgo/public_html/wp-content/EditorialEchoes/
0 12 * * * cp /home/samuelgo/echoes/echoes.xml /home/samuelgo/public_html/wp-content/EditorialEchoes/echoes.xml
0 12 * * * cp /home/samuelgo/echoes/sidebar.php /home/samuelgo/public_html/wp-content/themes/blix/sidebar.php
Each cron job is one line, but the webpage forces line wrapping. The server is somewhere in the mountian timezone of the US, which is currently 18 hours behind Canberra. I will have to modify the times when the difference changes.
I should probably explain these cron jobs.
The first one says “at minute 55 of hour 11 of every day of every month on every day of the week, move /home/samuelgo/echoes/echo*.mp3 to /home/samuelgo/public_html/wp-content/EditorialEchoes/”
The asterisk is very important there as the mp3 files will have different names each day, but will conform to the “echo(episode number).mp3” format. The move command is also important as it means I don’t have to delete the old mp3 files each night, and the command isn’t going to recopy old files. The time (which works out to 5:55am Canberra time) is very very important. The mp3 file must be available before anything else is online, otherwise podcast software will fail to download the new episode, which will result in them either giving up or constantly retrying (which would, with enough podcast clients, create a distributed denial of service due to the excessive number of concurrent connections), make WordPress provide incorrect information in the blog’s RSS feed about the mp3 file, and give people who manually download the file “404” errors until the file is online.
The second one says “at minute 0 of hour 12 of every day of every month on every day of the week, copy /home/samuelgo/echoes/echoes.xml to /home/samuelgo/public_html/wp-content/EditorialEchoes/echoes.xml”
The only real differences here are the time (Midday server time, 6am Canberra time), the command (copy instead of move) and the filenames. I’ll let you use your imagination for the third one.
Also overnight, I write the post for the Editorial Echoes episode, which I schedule to appear at 6am. WordPress will ultimately make it appear slightly earlier or later, which again emphasises the need for the MP3 to be online before 6am.
The only thing which cannot be automated is the Editorial Echoes website , which I manually update when I get around to it. It is normal for it to be a bit behind from time to time.
I hope that sheds some light on the automation which makes this all possible without me having to be up at 6am every morning.