Quality Script Patterns

If you use Unix to solve problems, odds are your team generates one-off shell/perl/etc scripts here and there. These scripts can get crappy. Here are some approaches that can help:

PowerOnSelfTest? pattern

When the script starts up, it runs its own UnitTests. They live in the same file as the script, and they're generally fast enough that you can't tell they're running.

CronPing? pattern
For scripts that live on crufty old machines, that are only used once in a while. It can be profitable to have a cron job that runs it every day or so to make sure that they are still working, can still talk to the database, etc. Couple with the PowerOnSelfTest? pattern and it's bulletproof.


CategoryUnixShellPattern


EditText of this page (last edited November 5, 2003) or FindPage with title or text search