procmail
[Top] [All Lists]

Re: testing for existence of a file without a fork

2002-05-03 09:03:17
When I wrote,

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.

Udi replied,

| (Unexpert interupt) if you lock something you must unlock too,
| isn't?

That's what I just said: if you create a lockfile you have to remove it.
Then Andrew pointed out how lockfile could be tricked into removing it.

| The lockfile timeout on the order of secunds!

The timeout doesn't apply here.  lockfile -r0 tries once and then quits.  On
the other hand, what if the file hasn't been used in a while ... wouldn't
lockfile consider it stale and remove and re-create it?

Anyway, head is lighter than lockfile, so the discussion of using lockfile
was just a sidelight.





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