procmail
[Top] [All Lists]

Re: Directing mail to a database

2000-10-02 16:36:58
On Tue, 3 Oct 2000, Christoph Schaper wrote:

i am doing something similar
to this, i handle web server logs with a
runlevel script
in perl that listens on a fifo and updates an sql server with those log
entries.

what you need for this is to create a fifo ( man fifo ) and then write a
perl script
or anything that suits you and can handle fifos and is your connector to
the mysql database.
you simply redirect your mail into that fifo and let the perl script do
the sql stuff.
greetings
Christoph
--

Seems simple enough.
I type mkfifo /home/mark/my.fifo

So my procmail reciepe would be like:

:0:
* ^TOprocmail
| /home/mark/my.fifo 

The perl script might look like:
#!/usr/bin/perl -w

open(FIFO, "< /home/mark/my.fifo") or die $!;
while (<FIFO>){
        #sort out table colums and values
        #execute sql to store in database
}
close(FIFO);

How does that look?
Do I need to start the perl script with procmail too?

:0:
* ^TOprocmail
| /home/mark/my.fifo
| /home/mark/bin/perl.script

Can I do it that way?

Thanks,
Mark Irvine

===================================
Always reply to mirvine(_at_)compsoc(_dot_)com
===================================


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