On 10/3/07, Mark Wagner <[EMAIL PROTECTED]> wrote: > On 10/3/07, Elizabeth Cortell <[EMAIL PROTECTED]> wrote: > > > I suggest (untested, but we do something like this in the office): > > Upon startup, check for the existence of a lockfile with agreed-upon name > > in some tmp directory. If it exists, exit immediately; otherwise create > > the file. Remove the file at end of execution or upon death of script (in > > the END block). > > > > I haven't thought out all the ways that could go wrong. Comments welcome. > > Will an END block get executed even if the script exits through an > error such as calling an undefined function? snip
Yes, Perl always tries to run END blocks, but there are some errors where END blocks cannot run (exhausted memory for instance). END cannot run if the machine dies (for obvious reasons), so that is one corner case you might need to be worried about. In general inspecting the process list or using a file with the pid of the current process in it (and if the file exists checking to see if that pid is the same as the script in question) is the right solution. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/