I listen to Radio Netherlands as my principal source of news. I find that they provide the most unbiast reports of daily events, as well as maintain a great level of International coverage seldom seen in North American media.
They do provide MP3s of their news feeds on a regular, hourly, basis. However, they have yet to have a Podcast feed. So what is one to do? One who wishes to listen to this news regularily without manually downloading the news each time?
Cron of course! Cron is the unix tool for scheduled tasks. But as I use Windows mostly, I’ve set it up under Cygwin. Cygwin is sort of *nix for Windows.
Once Cygwin is installed, and cron setup as a system daemon, the fun begins. First off, I wrote the instructions to download the news for Cygwin to execute, and save it to the “radionetherlands.sh” file:
wget http://download.omroep.nl/rnw/smac/latestnews.mp3 –limit-rate=20k –output-document=/cygdrive/d/radionetherlands/latestnews.mp3
date > /cygdrive/d/radionetherlands/LastUpdate.txt
The script essentially downloads the news in MP3 form at a max of 20kb/s, as to not interfere with online gaming and whatnot. It saves the file in my “D:\radionetherlands\” folder with Windows. Then it outputs into a text file the time at which the download was completed. This last bit is for debugging purposes.
Then, I have to tell cron to execute the script hourly, so I create a new file, named “jmcron”:
5 * * * * sh radionetherlands.sh
0 4 * * 4 wget
http://download.omroep.nl/rnw/smac/en_documentary.mp3 –limit-rate=20k –output-file=/cygdrive/d/radionetherlands/documentary.mp3
I then incorporate the above into cron:
crontab jmcron
crontab -l
So from now on, 5 minutes after the hour, every hour, my computer will download in the background the latest news from radio netherlands. And at 4AM, every Thursday, it will also download the documentary aired on Radio Netherlands.
This is one of the forte of *nix. Windows does have a scheduler, and an easy to use one at that. However, pulling off something like the above tends to be much more difficult than need be due to the lack of a proper command line interface and applications.
Comments
2 responses to “No Podcast? Use cron!”
I totally agree, I am however using http://www.kalab.com/freeware/cron/cron.htm and if that is all you need as far as *nix shell goes you might want to give it a try.
I’ve used it for quite a while to do scheduled backups.
If you want a more full blown cron / task scheduler which you can control remotely and execute remote scripts (POST/PING) you should look at VisualCron -> http://www.visualcron.com