Checking mail queue

May 16, 2008 at 11:50 am Leave a comment

Little script that will check the size of the mail queue and restart cyrus service if it grows over 60 mail messages.
I have to use it on one of the customer servers while investigating why cyrus hangs ocassionally:

#!/usr/bin/perl

#Get number of messages in mail queue.
open DATA, "mailq |grep Requests |" or die "Couldn't execute program: $!";

while ( defined( my $line = ) ) {
chomp($line);
@a = split(/ /, $line);
print $a[4] . "\n";
unless ($a[4] < 60) {
#Restart Cyrus
open CYRUS, "| rccyrus restart" or die "Couldn't execute program: $!";
}
}
close DATA;
close CYRUS;

Once written the script can be scheduled with cron to run periodically.
Meanwhile I have some breathing space to investigate why cyrus stops working.

I am seeing the following errors in /var/log/messages
:

May 16 09:12:30 galactica lmtpd[15608]: DBERROR db4: 60 lockers
May 16 09:12:30 galactica lmtpd[15645]: DBERROR db4: 60 lockers
May 16 09:12:30 galactica lmtpd[15645]: DBERROR db4: 60 lockers
May 16 09:12:31 galactica lmtpd[15635]: DBERROR db4: 60 lockers
May 16 09:12:31 galactica lmtpd[15640]: accepted connection
May 16 09:12:31 galactica lmtpd[15640]: lmtp connection preauth’d as postman
May 16 09:12:31 galactica lmtpd[15640]: DBERROR db4: 60 lockers
May 16 09:12:31 galactica lmtpd[15701]: accepted connection
May 16 09:12:31 galactica lmtpd[15701]: lmtp connection preauth’d as postman
May 16 09:12:31 galactica lmtpd[15730]: mystore: starting txn 2147484605
May 16 09:12:31 galactica lmtpd[15730]: DBERROR db4: 61 lockers
May 16 09:12:32 galactica lmtpd[15701]: DBERROR db4: 61 lockers
May 16 09:12:32 galactica last message repeated 2 times

I will appreciate if somebody has any idea what’s wrong.

Advertisements

Entry filed under: Linux. Tags: .

VNC Server on Red Hat Enterprise Server 4 How do I make the vi editor display or hide line numbers?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Categories


%d bloggers like this: