17 Mar 2006 hisham   » (Apprentice)

A silly little way to "watch" a semi-batch job

I'm running a compilation process that may take up to a few hours and that occasionally stops waiting for user input (yeah, I know, I'm working on it). I came up with a silly little way to let it run on background and not have to keep an eye on it... by keeping an ear on it. A little snippet of shell:

while true
do clear
   mv /tmp/last /tmp/old
   ls -l > /tmp/last
   if diff /tmp/old /tmp/last &> /dev/null
   then play /System/Links/Shared/sounds/KDE_Beep_ShortBeep.wav
   fi
   sleep 5
done

I ran this in a directory where the output of the compilation process is being logged, so the constant flow ensures ls -l is always changing... unless the compilation is stuck at a prompt. I used a little KDE beep to avoid disturbing my officemate (play is part of sox).

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!