Today, I received an email from my friend:
That worker script I wrote for MI is working fine, but there's one problem. Sometimes, it takes too long to run, and the next cron job comes along and they double up.
My first thought was to write a file to disk (a lock) and remove it on exit - so the next process will know to die... but what happens if it quits (or is killed) without removing the lock? Then nothing runs...
Is there a CPAN module or example you can think of, this is so obviously a common os-level problem that already has a solution, right?
Unfortunately, I don't know the answer to this, so I've come to the monastery for help.