procmail
[Top] [All Lists]

Re: locking a script

2000-12-21 23:04:26
Andrew Edelstein <andrew(_at_)pure-chaos(_dot_)com> writes:
On Thu, Dec 21, 2000 at 12:23:17PM -0800, Collin Park wrote:
Here's what I'd do:

...
    :0: something.lock
    |cd /home/httpd/turn;su -c ./mail2sms.pl nobody

This is only appropriate for a delivering recipe, and only when you're going
to deliver to file (which needs to be locked to prevent something else from
trying to write to that file while it is open).

Wrong.  Non-delivering recipes may need lockfiles and recipes that pipe
into programs may need lockfiles: it all depends on the action.  If the
action may safely by invoked by multiple copies of procmail
simultaneously are there are no external locking requirements (to avoid
collisions with other programs), then the recipe does not need a
lockfile.  If that isn't true, it does.  Period.

Perhaps the most familiar example of such a recipe would be the
standard duplicate message eliminator:

        :0 Wh: msgid.lock
        |formail -D 8192 msgid.cache

The formail -D option requires exclusive access to the msgid.cache file
and so must be protected by a lockfile.


We don't know enough about the mail2sms.pl command to know whether a
lockfile is needed on that recipe.


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

<Prev in Thread] Current Thread [Next in Thread>