procmail
[Top] [All Lists]

Re: testing for existence of a file without a fork

2002-05-02 13:21:49
On Thu, 2 May 2002, David W. Tamkin wrote:

Martin recommended,

|   lockfile -0 -r0 plainfile
|
| which returns 0 (true) if it could lock the file - hence the file didn't
| already exist - and non-zero if it could not.

I think just -r0 is enough, since it says "don't retry."  There's nothing to
wait for if lockfile doesn't retry.

Unfortunately, however, that does the job only if the file exists.  If the
file *doesn't* exist, lockfile creates it, and then I need an additional fork
for rm to remove it.


        (Unexpert interupt) if you lock something you must unlock too,
        isn't?  The lockfile timeout on the order of secunds!
        Can you lockfile -l0 ?

Bye,
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail