Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Lightweight Solution To "Only 1 Process Running" On AIXby Limbic~Region (Chancellor) |
on May 01, 2009 at 14:15 UTC ( [id://761299]=perlquestion: print w/replies, xml ) | Need Help?? |
Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
All,
There are a number of non-perfect solutions to running only 1 instance of a process at a time. The common solutions are pid files, lock files, checking the process table - or some combination. The trouble with most of them is that they are not bullet proof (you can delete a locked file for instance). Dominus published a presentation on File Locking Tips and Traps back in 2003. One of the suggested solutions was to lock the file of the running process itself: In the few instances I have needed this, one of these have worked. Recently I suggested a co-worker improve his code by using one of these techniques and he told me neither worked on AIX. The error in both cases is "unable to lock: A file descriptor does not refer to an open file." Does anyone have any insight into why this is or have any suggestion on an alternative lightweight and nearly bullet proof way to accomplish the original objective? Cheers - L~R
Back to
Seekers of Perl Wisdom
|
|