January 07, 2008

master of the spinner

Ok so today I got a little side-tracked at work. If you have ever watched FBSD boot up you will recognize what spinner I'm talking about. I have about a million scripts that do various things, some bash some perl.

One set of scripts that I have been working on lately are my scripts to tabulate our yearly email stats. These scripts take for ever to run. Our daily log files are anywhere from 50M to 100M+ per/file. So usually I work on this in the background.

I have always wanted these scripts to show some working progress meter or something while churning away on these log files "eye candy". I got the notion to make this happen today and actually found the bits and pieces I needed to get it done.

For the perl scripts I found Term::Twiddle. This little perl mod lets a process run in the background while in the foreground doing something neat on the terminal. (very easy to use)

I also found an easy way to make this happen in bash and learned a bit about tput. I have not integrated this into the bash side of my script package yet but that should not be too hard.

Oh by the way, I did get 3 months worth of log files calculated for all of our email servers. And worked on some other projects :-P