I want to make sure only one process at a time runs. So I want to make sure jobB doesn’t run unless jobA is not running.
It would be great if it had some ability to retry the lock so I don’t have to code that. Something vaguely like this:
LockFileModule->lock(
lockfile => '/fabulous/pants',
retries => 12,
timeout => 25,
timebetweenretries => 30,
) or die "the other job is still running";
Whats the best way to do this in Perl? I’m hoping there is a good CPAN module for this.
This will lock the DATA section of the program itself. I use this technique, and it works very well.
You can expand it to enable retries pretty easily.