procmail
[Top] [All Lists]

Re: LOCKFILE syntax, questions

2002-07-17 16:57:23
Dallman Ross asekd,

| Now I have in the braces:
|
|    {
|       # what's the file to use?  Lock it
|       LOCKFILE = $SPAMSNAG$LOCKEXT
|       LOCKTIMEOUT = 30
|
|       DUMMY=`cat $mytmpfile.sa >> $SPAMSNAG && rm -f $mytmpfile.sa`
|
|       # unlock file
|       LOCKFILE
|
|      :0  # no lockfile here; .myspam is a directory, not a flat file
|        .myspam
|   }
|
| Okay, but I'm not entirely sure that it works.  I run a procmail process
| that triggers this in the background, and meanwhile I keep doing dir
| listings.  I never see the lockfile.

The lockfile exists only long enough for the code between setting it and
unsetting it to run.  You have a cat and an rm, not really much.  That
shouldn't take more than milliseconds.  You just don't happen to be catching
that tiny window of existence when you take a directory listing.

| I do see in the verbose log this:
|
| procmail: Assigning "LOCKFILE=spamsnag.lock"
| procmail: Locking "spamsnag.lock"

There you go.

| (So why can't I see the lockfile in my dir listing?)

Because you're human and you operate at human speeds.

| I first had in place of DUMMY in the second version:
|
|       # do whatever to create or alter file contents
|       #:0 c
|       # | cat $mytmpfile.sa >> $SPAMSNAG && rm -f $mytmpfile.sa

You could put a second colon on that one and get a local lockfile named
$SPAMSNAG$LOCKEXT.  If you ever uncomment it, in fact, you should.  The other
thing is that it needs `i' as you found out:

| I think that worked as well, but the verbose logs troubled me,
| because they read
|  procmail: Error while writing to " cat $mytmpfile.sa >> $SPAMSNAG &&
| rm -f $mytmpfile.sa"

| That "Error" scares me.  I think it's not really an error, but an
| indication that the piped commands don't do anything with what's
| fed them?  Oh, yeah, that might be it.  I suppose I need an `i'
| flag on that recipe.

Yes, exactly.

| Anyway, which syntax is better?

Couldn't say.  Here's another, to complicate things:

 LOCKFILE=$SPAMSNAG$LOCKEXT
 :0
 * ? cat $mytmpfile.sa >> $SPAMSNAG && rm -f $mytmpfile.sa
 { }
 LOCKFILE





_______________________________________________
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>