in reply to lock files vs. non-predictable file names

Along the same lines as merlyn's suggestion; replace the
system("/bin/rm $lock_file");
with
unlink($lock_file);
Again you're saving launching another process.

One algorithmic problem with your lockfile approach is that if your process dies (for whatever reason) without removing the lockfile all subsequent runs of the program will think there's already an instance running; even though there isn't.

one last thing.... use strict. Learn what it is and start using it. It will save you much pain as you continue to learn and use perl.

Replies are listed 'Best First'.
RE: Re: lock files vs. non-predictable file names
by RuphSkunk (Acolyte) on Aug 26, 2000 at 01:40 UTC
    Good point on the algorithmic problem. I inherited that functionality from the previous script, thinking about duplicate processes not premature death. /me is reading up on strict. ty