procmail
[Top] [All Lists]

Re: Logging and file grepping

2004-04-16 15:20:32
On Fri, Apr 16, 2004 at 01:39:21PM -0400, Daniel wrote:

I understand the lockfiles are for delivering as well. I never had
an issue where it would become corrupted. In examples I've always
notice the lockfiles were used for forwarding and hardly used for just
delievering to the spool file.

It would interest me to see a source or citation for this.  Either
we're miscommunicating, as you suggest, or somebody has something
very wrong.  No insult intended.


Okay, so it didn't match.  Was that in your netskyd_attach file?

Yes, test.*\.txt was in the netskyd_attach. Except you later go to
say that the dot(s) messes things up (only for fgrep which I was not
using). I will try different combinations to see what I can to do get
it to work.

Not exactly.  What I said, or wanted to have said, is that the
quoting will cause fgrep to fail.  The dot is fine -- fgrep
sees it as a dot,  fixed string; not a regex.

The reason why I left off the quotes is because there are no spaces. 

Okay, if your file is controlled ant that is the case, fine.
I have been persuaded in recent months by a programmer I respect
to start quoting most vars, and do so consistently, even though
in most cases I don't need them -- because when you once don't
think it through and it bites you in the arse, and you spend
hours figuring out why (or one of the users who relies on your
code can't get it to work), you'll hit yourself on the side of
the head and say you should know better.  :-)  That's a generic
"you," of course.  I've been there myself.  The point is that
if it's a stylistic habit, you won't get caught out with your
pants down, and it doesn't hurt to have it.  And you won't have
to go through the burden each time you write something of asking
yourself if *this* one needs quotes, or if there never will be
a case of . . . or whatever.


currently using fgrep only because I haven't found a way to use
external regexs. I understand that fgrep using fixed strings but with
-x it must also match the line. Using this method means that for
every differnce in a file name I must also list it in the external

That's why I suggested the -w switch might be better for you.

I understand regexs, but what I can't get to work is matching
those regexs.  If I insert what I have in my external list right
into procmailrc, it works.  As soon as I use the external file it
fails. Even when using the [egrep -wis -e].

Does your rc get run on a separate mail machine that doesn't have
the same binaries as you see on your shell host?  Are the verbose
logs helpful in diagnosing just what's going wrong?

So from what you stated I would have a recipe that would look
something like this

:0
* ? [match subject to external "subject" file]
{
  :0 B
  * ? [match filename to external "attach" file]
  {
    LOG="[write log]"
    :0:
    *
    /dev/null
  }
}

As it is now I would need 12 of these, since I have 12 netsky file
lists. I guess it's time to rethink the file structure.

What is with that empty condition in the last recipe?  You certainly
don't want that.  I'd do the above something like this:

  :0
  *      ?  echo "$SUBJECT"  | egrep -wis -f subjects-file
  * B ?? ?  echo "$FILENAME" | egrep -wis -f filename-file
  { LOG = "whatever"  HOST }


I have tested that, and it works.

 12:03am [~] 233[0]> egrep --version | head -1
egrep (GNU grep) 2.4

Inside my subjects-file is this, as a test:

 12:04am [~] 234[0]> cat Mail/subjects-file 
[a-z]*

-- 
dman

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