procmail
[Top] [All Lists]

RE: Help with procmail recipe

2002-04-29 09:27:20
At 16:34 2002-04-29 +0800, francisv(_at_)dagupan(_dot_)com did say:

It worked :) Thanks for your help. I also modified it for grouping purposes:
[snip]

If you're going to brace all the copies, then you should omit the 'A' flag from the additional copies.

I'm now figuring out how to modify this so I'll just list all the numbers in
a file, read it and send it out via SMS.

Put a lock on the recipe, deliver the message to a temporary file (in this case, piping it through your email2sms filter), then do your shell scripting to loop on numbers, redirecting in from that file.

:0:smsfile$LOCKEXT
* ^TOsmsalert\(_at_)dagupan\(_dot_)com
{
        # no lock required here, since the whole rule is under lock
        :0cw
        | email2sms > smsfile

        # dunno why you have the second one, I assume because you have a
        # second list, though your own prototype didn't reference it.
        NOC=/etc/procmail/include/noc-numbers.txt
        SOFTWARE=/etc/procmail/include/software-numbers.txt

        # i flag is necessary here because you're not really reading stdin
        # (you could start with a 'cat - > /dev/nul ;' I guess)
        :0i
        | for NUMBERS in $NOC; do gnokii --sendsms $NUMBERS < smsfile ; \
                sleep; done
}

        | email2sms | for NUMBERS in $NOC; do gnokii --sendsms $NUMBERS;
sleep; done

This would only work if email2sms output multiple copies to be read in by gnokki. As should have already been made clear, this isn't going to happen - the pipe would have been depleted when the piped-to program completed its first execution.

[kersnip]

As per disclaimer, recipe is untested (I don't have email2sms or gnokki, not to mention the additional time to debug this for you).

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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