procmail
[Top] [All Lists]

Re: LOCKFILE syntax, questions

2002-07-17 17:15:43
On 17 Jul, David W. Tamkin wrote:
| 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.
| 
|[...]

And a little (more) proof ...

$ cat thisrc 
DEFAULT = /dev/null
NL = "
"
PMDIR = $HOME/.procmail
TESTDIR = $PMDIR/test

SPAMSNAG = $TESTDIR/spamsnag
DUMMY=`ls $SPAMSNAG$LOCKEXT 2>&1`
LOG = "Before setting LOCKFILE:$NL$DUMMY$NL$NL"

LOCKFILE = $SPAMSNAG$LOCKEXT
LOCKTIMEOUT = 30

DUMMY=`ls $SPAMSNAG$LOCKEXT 2>&1`
LOG = "After setting LOCKFILE:$NL$DUMMY$NL$NL"

LOCKFILE

DUMMY=`ls $SPAMSNAG$LOCKEXT 2>&1`
LOG = "After UNsetting LOCKFILE:$NL$DUMMY$NL"

$ procmail ./thisrc </dev/null 
Before setting LOCKFILE:
ls: /home/deh/.procmail/test/spamsnag.lock: No such file or directory

After setting LOCKFILE:
/home/deh/.procmail/test/spamsnag.lock

After UNsetting LOCKFILE:
ls: /home/deh/.procmail/test/spamsnag.lock: No such file or directory


-- 
Reply to list please, or append "8" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


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