in reply to RE (2): Simple Locking
in thread Simple Locking

However KM pointed out to me that the system call to "touch" is not the best approach if the file does not exist.

I said this simply becuase it isn't a safe way to use system(). If someone passes "/tmp/file; mail < /etc/passwd" as $lockfile, there could be trouble. I would either use a safer system like:


Or, simply an open FH, ">>$lockfile" ... approach.