Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 156
  • Last Modified:

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?
0
smauntz
Asked:
smauntz
  • 3
  • 3
1 Solution
 
TintinCommented:
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.
0
 
ahoffmannCommented:
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.
0
 
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.

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

   system("./timeconsuming.pl&");
0
 
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?
0
 
ahoffmannCommented:
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.
0
 
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 need...it 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.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now