Thanks for the response Mark. That is doubtfully the cause of the crash on my
system, as it will occur even if there are no marked/undelivered messages in the
database when maintenance is run... I will hang on to your script though :)
/eli
> I had similar problems, but I think it may have related to the number of
> messages returned. I had something like 40,000 to purge, and I don't think
> the query was returning.
>
> From memory, if I changed all but 100 customers to state=002 and then ran
> purge, it worked. But this was a real pain so I ended up writing a perl
> program to do it.
>
>
> #!/usr/bin/perl
> use DBI;
>
> $db_dbmailauth = DBI->connect($DBMAILAUTH_DBHOST, $DBMAILAUTH_DBUSER,
> $DBMAILAUTH_DBPASS);
> $db_dbmailstore = DBI->connect($DBMAILSTORE_DBHOST, $DBMAILSTORE_DBUSER,
> $DBMAILSTORE_DBPASS);
>
> print "Getting message list (status=003) \n";
>
> my $query = $db_dbmailstore->prepare("select message_idnr from messages
> where status=003 order by message_idnr limit 50000");
> $query->execute || print "error was ".$db_dbmailstore->errstr;
> $query->bind_columns( undef, \($message_idnr) );
>
> print "DELETING THE FOLLOWING MESSAGES\n";
>
> while ($query->fetch) {
> print "+ $message_idnr \n";
>
> #print " - messageblks \n";
> my $query2 = $db_dbmailstore->prepare("delete from messageblks where
> message_idnr='$message_idnr' ");
> $query2->execute || die "error was ".$db_dbmailstore->errstr;
>
> #print " - message \n";
>
> my $query2 = $db_dbmailstore->prepare("delete from messages where
> message_idnr='$message_idnr' ");
> $query2->execute || die "error was ".$db_dbmailstore->errstr;
>
> ##print " - message_headers \n";
> #
> #my $query2 = $db_dbmailstore->prepare("delete from message_headers
> where message_idnr='$message_idnr' ");
> # $query2->execute || die "error was ".$db_dbmailstore->errstr;
>
> }
>
>
> Crude but effective. Ignore mail headers, that¹s part of our webmail
> interface we're working on.
>
> /Mark
>
>
>
> --
CAUTION: Repeated use of finger can cause a system to become overloaded, which
can cause it to stop responding.
--Infinite wisdom from the font that is ISS 6.2.1