Server Kills my script

I have a script that uses the mime-lite perl module to send out mime email messages to a list of users.  The basic idea is this...

I have a file that lists all my user email addresses.  My mailer program is supposed to grab one of those addresses every 2 seconds and send one of them out.  My problem is that I am up over 50 users now, and the server seems to kill my script after about 10-15 emails.  I need this thing to stop killing my script, but am not sure how to go about it.  Does anyone have any ideas?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would suggest either using a mailing list handler like Mojomail (which I can personally recommend), or try using the Mail::Bulkmail module to send your mails.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
is it a CGI script called by the server by request of an URL?
Then the server's timeout for CGIs is most likely the reason.
Either change the timeout, or use a more sophisticated list of adresses, or use a specialised program, or start you script in background and let the CGI itself return immediately.
smauntzAuthor Commented:
I'm running the cgi script in the cgi-bin, but from a ssh command prompt.  I think the problem is related to the timeout for CGIs, but can't change that since it's a hosting company.

If by running something in the background, you mean something like this...

mailer &

I've tried that and it still gets killed.  It doesn't crash, I get a message saying my program had been killed.

I'll look into bulkmail, and mojomail since I don't have experience with them.

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

in your CGI call a 2'nd program which does the time consuming work, like this:

smauntzAuthor Commented:
I tried ahoffman's advice, but the script that does the time consuming work is still automatically killed after approximately 20 secs of work.  The hosting plan I have right now is a virtual hosting plan, so I don't have a dedicated server.  They just told me today that I won't be able to run any cgi for more than 15-30 secs because they've set a limit on the server.  Any suggestions?  Would mojomail solve this kind of problem without having to go to a more expensive hosting plan?
there is no way if the shell and/or OS is setup to give you only 15-30 secs per process.
You only can split you work in parts, and call them on behind another.
But it might be much simpler to get rid ogf the limit.
smauntzAuthor Commented:
I'm going to go ahead and accept Tintin's comment as the answer here...Thanks for the work though ahoffmann.  It looks like mojomail can do exactly what I gives me the ability to break a sendmail job up into timed chunks.

Unfortunately, I can't get rid of the limit without going to a more expensive hosting plan (not an option for my client here), and I don't want to spend the time splitting the work into parts unless absolutely necessary.  It would turn a very simple mail script into a more complicated program with pipes and process forks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.