On Mon, Nov 20, 2017 at 14:42:01 -0500, Jean-Louis Martineau wrote: > Each process should take a lock on the holding directory (a pid file),
Okay, makes sense. > + my $pidfn = File::Spec->catfile($dirfn, "pid"); > + if (open(my $pidh, $pidfn)) { > + my $pid = <$pidh>; > + if (kill($pid, 0) == 0) { > + # pid is alive, skip this directory > + next; > + } > + close($pidh); Quick question: does the above leave $pidh open in the case that pid is alive? (That is, if the code hits the "next" does that miss a needed call to close()?) Nathan ---------------------------------------------------------------------------- Nathan Stratton Treadway - natha...@ontko.com - Mid-Atlantic region Ray Ontko & Co. - Software consulting services - http://www.ontko.com/ GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt ID: 1023D/ECFB6239 Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239