The Digital Cave

Primitive Life in a Technological World


Misc. Scripts

This page lists various scripts I have written over the years which I have found to be useful. They cover a wide range of functionality; I am releasing them here in the hope that someone else finds them useful.

All these scripts are released under the GPL. If you wish to include them in a non-GPL'd project, feel free to contact me about dual licensing.


This is a backup script which can be used to take daily (or whatever interval you desire) snapshots of portions of your system, and upload them to a different machine. It relies on rsync over ssh, and thus can be easliy used on just about any *nix machine (I personally use it extensively on OSX and Linux). I have managed to get it to run under Windows XP using variations of rsync and ssh, although due to a lack of a real cron-style scheduler in Windows XP Home, it had to be launched manually, which quite reduced its usefulness.

This script must be customized for each installation; I have avoided using a separate configuration file as I find that this approach works fine. Feel free to change this if you wish.

You can download the script from here, and put it where desired (/usr/local/bin or equivalent).

To configure the script, you should do the following:

  1. Set the program location for rsync, and ensure that all requirements (e.g. ssh) are isntalled. If you are on a decent platform, this should be as simple as 'apt-get install rsync' or the equivalent.
  2. Add backup locations LOC1, LOC2, etc as desired. Each location will copy a given folder from one machine to another (whether client to server or server to client).
  3. Add the LOCX variables to the loop, in the order they should be executed in.

Fan Monitor

This script runs in the background and monitors temperatures from lm-sensors, and adjusts fan speed accordingly. This is useful for machines (such as the Macbook Pro) whose firmware does not scale fan speed quickly enough.

This package includes the actual runnable script, a configuration file with sane defaults for Apple laptops (easily adjustable for others), and an init script. To install, extract the package to / (such that fanmonitor goes to /usr/local/sbin, fanmonitor.conf goes to /etc, and the init script fanmonitor goes to /etc/init.d). On Debian systems, run update-rc.d fanmonitor defaults to install it to run at startup.

You can download the installation package here.

Download CBC Radio 2 Concerts on Demand

CBC Radio 2 has a wonderful site where you can listen to various concerts, recorded over the past few years. It has some wonderful Jazz, among other non-mainstream music. Unfortunately, it requires you to stream the songs, which can be impossible if you want to listen offline, or if you have limited bandwidth (say, at work). This script downloads the songs, normalizes the volume, and converts to MP3. You can then add it to your favourite music player and change the ID3 tags as desired.

This script requires that you have curl, mplayer, and normalize installed. Due to laziness on my part, it also requires that you can run bash scripts from the current directory (i.e., it won't work from /home if you mount home as noexec). When run, it requires a single argument of the URL for the 'all.asx' file; this is an XML file which describes the artist, title, and tracks of the various songs, as well as URLs to each track. For instance, to download the concert for the excellent Meredith Luce, use the command:


The script takes some time to download, as it just streams in (more or less) real-time. The downloaded songs are saved to the current working directory.

You can download the script here.