procmail
[Top] [All Lists]

Re: locking the logfile -- how to?

1997-08-23 14:32:45
Timothy Luoma wrote in praise of global lockfiles as a way of locking the
logfile,

| The 'meat-axe' method works just fine for me anyway.

It also obviates the need for any local lockfiles (unless you're trying to
prevent conflicts with other procmail rcfiles or other programs).

Just be sure to use `W' or `w' whenever you launch a clone so that the
clone's logging won't interfere with the parent's (or with that of another
clone).  Clones do not inherit lockfiles.  If you give the clone its own
global lockfile, that won't prevent it from clashing with the parent for
log entries (each will have its own lock); if you try to make the clone
use the same global lockfile, it will hang, because the parent already
has that lockfile (though I suppose that, if the clone is launched without
`w' or `W' so that the parent can exit first, then telling the clone to use
the same global lockfile as the parent is a good way to make the clone wait
until the parent has finished; in my uses, I have the opposite need [making
the parent wait until the clone has finished], so I use a `W').

In general, I would not recommend the course of action that Mr. Luoma has
chosen.  If you continue to use local lockfiles, the global lockfile is of
use only to lock the logfile; if you stop using local lockfiles because you
have the global one in effect, you can run into trouble with other rcfiles
or other programs.  A lot depends on how much mixing occurs in your logfile
and on how much damage the mixing does.