in reply to Directory locking

  1. Do you really want to lock the whole directory, or just ensure one copy of a.pl is running at a time?
  2. Will the files always be created/overwritten on execution of a.pl, or can they be appended to?
  3. Will there be other programs/scripts/etc that create/write/append to these log files?
You could either use flock or use sysopen with O_CREAT|O_EXCL on a file a.pl.lck in that directory. Handling error conditions is left as an exercise to the writer.

Replies are listed 'Best First'.
Re^2: Directory locking
by debugger (Novice) on Feb 17, 2010 at 03:49 UTC
    I want to lock the whole directory.
    Yes the files will always be appended(if present) and created and written(if not present).
    No there will be no other scripts that create/write/append to these log files.