Mark Irvine wrote:
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?
Well it probably would cause problems to initiate the fifo listener when
you write on it
what i would do is, write a runlevel script to initialize a fifo
listener script at runlevel
startup that just waits for input. it opens the database connection at
initialization time and closes
it when you drive your server down.
just make a runlevel script invoke a fifo listener and you are happy
--
---------------------------------------
Christoph Schaper
email :christoph(_at_)schaper(_dot_)org
homepage http://schaper.org/christoph
http://schaper-edv.de
---------------------------------------
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail