procmail
[Top] [All Lists]

Re: Directing mail to a database (fwd)

2000-10-05 02:26:34


Harry Putnam wrote:
... 
Probably a dumb thought and not sure I understand what a fifo is or
does but why not just pipe direct to the perl script leaving out the
fifo stuff?
Because if you pipe it directly then you need to establish
a connection to your sql server with every update.
The "fifo" solution lets you connect to the database once when it starts
up.
then just keeps listening on the "named pipe" updating the database much
more
efficiently.
greetings,
Christoph


-- 
Hi,

Thanks for the suggestions. I'v got it running now, and it's sending mails
to the database as I wanted. Just a little claening up of the perl code
left to do. 
 
In the end I did use a fifo, and I'm starting it with a runlevel script.
The procmail reciepe is now simply to put:
| formail -c > /home/mark/.mail.fifo
at the end of the reciepe.
          
I Don't know much about how runlevel scripts work, I just copied from the
lpd script and changed it a little. Seems to work, but is there anything I
need to be careful about here?

The runlevel script I'm using:
------8<------------------------------------------------------------
#!/bin/sh
#
# mail2db       This shell script takes care of starting and stopping
#               mail2db (mail to database perl script).
#
# chkconfig: 2345 99 99
# processname: mail2db  

# Source function library.
. /etc/rc.d/init.d/functions
        
# Source networking configuration.
. /etc/sysconfig/network
         
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting mail2db: "
        /home/mark/bin/mail2db.PL&
        echo
        touch /var/lock/subsys/mail2db.PL
        ;;
  stop)
         # Stop daemons.
        echo -n "Shutting down mail2db"
        kill -9 `/sbin/pidof maildb.PL`
        echo
        rm -f /var/lock/subsys/mail2db.PL
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: mail2db {start|stop|restart|reload}"
        exit 1
esac
        
--------8<----------------------------------------------------
  
         
Cheers for the help,
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>
  • Re: Directing mail to a database (fwd), Mark Irvine <=