[Exim] filehandles and such

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Dan Kappus
日付:  
To: exim-users
題目: [Exim] filehandles and such
My boss, the CEO wanted me to write to all our customers about something
or another.

So I wrote this simple perl script, something like this:

********************************************************
#!/usr/bin/perl

open (FILE, "path");

while(<FILE>){

     open (MAIL, "| /usr/sbin/exim -t");
     print MAIL "To: $_";
     print MAIL qq#From: "The Dark Lord of the Sidth" <lord@???>" \n#;
     print MAIL "Subject: Your childish rebellion will be crushed\n\n";


     print MAIL << yoda;



    We have your precious Princess and will kill her unless one of you
    reveals the location of the secret Rebel base. Do not underestimate
    the Power of The Dark Side.


    Sincerely,


    He-With-Bad-Makeup


yoda

    close MAIL;


}
**********************************************************



FILE is a file with several thousand email addresses.

When I first ran this, everything was okay until about message
700, where it crapped out. Exim stated something about not
being able to open enough file descriptors to send any more
of these messages.

What is the problem here? Is it with Exim (doubt it) or
the operating system setup (Debian Linux, kernel 2.2 something) (possible)?


What I ended up doing was making the script sleep for
a second in between each message, which worked, but was a drag.
What other solutions can people think of? Should I have written
the messages into a batch for exim to process later?


Thanks for the advice,

Dan Kappus, system admin for some dot com something