Whew - 20 mailing lsits. That could be it :)
I've had problems in the past with web spiders spidering the archives and just going ape... stuff... with that.
So, you could just disable the archives in some of your lists.
The other option is to just have a script that sets a limit on how many copies of the mail.cgi can run at once. There is some setup to this, but:
Rename your mail.cgi script to: "mail.pm"
and save the below script:
- Code: Select all
#!/usr/bin/perl
# A weird fix.
BEGIN {
if($] > 5.008){
require Errno;
require Config;
}
}
use lib qw(
./
./DADA
./DADA/perllib
);
use CGI::Carp qw(fatalsToBrowser);
$ENV{PATH} = "/bin:/usr/bin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
use Fcntl qw(:DEFAULT :flock O_WRONLY O_TRUNC O_CREAT );
my $State = '/home/youraccount/.dada_files/.tmp/counter.txt';
$State = make_safer_per($State);
my $Limit = 25;
main_f();
sub main_f {
plus();
if(poll() >= $Limit){
print "Status: 503 Service Unavailable\r\nContent-Type: text/html; charset=ISO-8859-1\r\r";
}else{
do(make_safer_per('mail.pm'));
}
minus();
return;
}
sub poll {
sysopen(FH, $State, O_RDWR|O_CREAT) or die "can't open counter: $!";
flock(FH, LOCK_EX) or die "can't flock counter: $!";
my $num = <FH> || 0;
close FH or die "can't close counter: $!";
$num =~ s/^\s+//o;
$num =~ s/\s+$//o;
return $num;
}
sub minus {
sysopen(FH, $State, O_RDWR|O_CREAT) or die "can't open counter: $!";
flock(FH, LOCK_EX) or die "can't flock counter: $!";
my $num = <FH> || 0;
seek(FH, 0, 0) or die "can't rewind counter: $!";
truncate(FH, 0) or die "can't truncate counter: $!";
(print FH $num-1, "\n") or die "can't write counter: $!";
close FH or die "can't close counter: $!";
}
sub plus {
sysopen(FH, $State, O_RDWR|O_CREAT) or die "can't open counter: $!";
flock(FH, LOCK_EX) or die "can't flock counter: $!";
my $num = <FH> || 0;
seek(FH, 0, 0) or die "can't rewind counter: $!";
truncate(FH, 0) or die "can't truncate counter: $!";
(print FH $num+1, "\n") or die "can't write counter: $!";
close FH or die "can't close counter: $!";
}
sub make_safer_per {
my $string = shift || undef;
if($string){
$string =~ tr/\0-\037\177-\377//d; # remove unprintables
$string =~ s/(['\\])/\$1/g; # escape quote, backslash
$string =~ m/(.*)/;
return $1;
}else{
return 0;
}
}
as, "mail.cgi". upload it to your server, change the permission to 755.
You will need to make the following changes in the script:
- Code: Select all
my $State = '/home/youraccount/.dada_files/.tmp/counter.txt';
You'll need to change this to the absolute path to some file ( you do not have to make this file, already). I kind of suggest doing what I'm doing - using the advanced installation, and putting the path into your, ".tmp" directory and calling the file, "counter.txt" .
Then, you can optionally set the other variable:
- Code: Select all
my $Limit = 25;
This sets how many copies of Dada Mail you'd allow to run. It's set at 25 - you can set it less.
If that all works, there you go - you won't get a huge amount of processes running at once.
The only other thing - to be prudent, would be to set a cronjob - something like this:
- Code: Select all
0 * * * * rm /home/youraccount/.dada_files/.tmp/counter.txt
This will remove (delete) that counter file every hour - should stop the script from getting sort of a dead lock.
Make sure to get this path right - it *will* remove something and you don't want the wrong thing to be removed!