Sun, 15 Jul 2007

The Life and Opinions of Tristram Shandy, Gentleman

— SjG @ 8:53 pm

Laurence Sterne, 1759-1769. Read as a Gutenberg Project e-book, downloaded via

I once had a co-worker (hi, Bob!), for whom completing an anecdote or telling a full story was an impossible task. Each new detail necessitated a digression, from which several tangents emerged, and so on, ad infinitum. We used to torment him by interrupting with nerdy / computer-science cries of “Pop the stack, Bob! Heap overflow!”

This is also the main thematic joke of Tristram Shandy, where, in telling us his life story, Tristram fills up three volumes getting up to his own birth, and then never really gets back to his own story with the exception of a mixed-up journey across France much later in his life. Life and Opinions is light on the life, and heavy on the opinions. We learn about his theories of many things, we overhear many conversations about religious, political, and military philosophy, and witness events reminiscent of Rabelais, but we’re too busy with these diversions to get much of his personal story.

Tristram has more to offer, though, than its (sometimes tiresome) tangents. Tristram’s amusing comments to the critics stand out, as do his grandiose opinions of his own literary prowess and techniques. However, overall, it’s the characters of Uncle Toby and his interactions with Tristram’s father Walter that make the work. Both men are peculiar, outrageous, and yet oddly believable, and their interactions can be surprisingly touching.

As with many of the older works I’ve read, Tristram suffers somewhat from what I call
Shakespeare/Bible Copycat Syndrome (in which a work so widely imitated and quoted that the original seems clich├ęd).

In what should give hope to those of us who are getting older and accomplishing less than we’d hoped, Sterne started writing this humorous, meandering tale when he was 45. Nine volumes and ten years later, he’d completed one of the great works of English humor. So there’s still hope for us.

Filed in:

Mon, 9 Jul 2007

Preventing “Overlapping” cron Processes

— SjG @ 9:43 am

I have a number of very time consuming processes that get run by cron on various machines. Some of these processes would cause problems if they “overlapped” — e.g., a new one gets started before the old one is done.

Now, there are a lot of ways to make sure you’re unique if you’re a process, but often I don’t want to modify the source of the process to add that (for many packages, I’d rather not patch and merge and recompile every time a new version comes out). So I write a simple shell script to run the process; cron calls my shell script, and prevents the overlap.

This uses the magic of “pgrep” — unfortunately, different versions of pgrep have different flags, so the code I originally wrote (which used the “-c” flag, which counts the matching processes) didn’t port to most systems. It’s easy enough to pipe the output through a “wc -l”.

I did have to move the pgrep exec out of my if statement, though, since the comparison was going against the return code, not the output. Doh!


RUNNING_PROCS = `pgrep -f longRunningProcess | wc -l`
if [ "$RUNNING_PROCS" -gt "0" ]
        echo `date` longRunningProcess still running. I\'ll let it finish. 
        echo `date` Starting longRunningProcess.
        /path/to/longRunningProcess -flags 
echo "----------------------------"

Filed in: