Greetings - I contacted Dustin off the list and he requested a copy of the
scripts and that I post this to the list...so here it is.  I posted this
question about a month ago however I didn't receive any response.  Since
this problem is not actually flaming I moved on to other stuff.  Time to
revisit it again, I guess.

*** Original (edited) email to Dustin ***

Greetings Dustin - I have this issue with my Cyrus too...sometimes it just
goes to sleep.  We have a cron job that uses a Perl module to attempt a POP3
connection every fifteen minutes.  If the server doesn't respond the script
will restart Cyrus.  Most restart messages indicate that ctl_mboxlist list
died, however I haven't been able to locate the reason why.  For a while I
thought it was load related.  We run a virus scanner and it keeps the
server pretty busy, however reducing the load made it act worse instead of
better.  I have included the scripts below.  You will probably need to
install the
Net Perl module to get the POP3 functionality that makes it work.  Please
let me know
if you get any clues on this...our server snoozes approximately once per day
(it was four times a day when I turned off the scanner...I think the machine
got bored ;)  Hope this helps.

*** Text of scripts follows ***

[root@mailhost /root]# cat popcheck.sh
#!/bin/bash

/root/check-pop.pl
if [ $? -eq 0 ]
then
echo "Pop server's hung, killing & restarting cyrus"
/bin/kill -9 `/bin/ps axuwww|/bin/grep cyrus|/bin/grep master|/bin/grep -v
grep|/usr/bin/tr -s [:blank:]|/usr/bin/cut -f 2 -d " "`
/usr/bin/killall -9 pop3d imapd lmtpd ctl_mboxlist
/usr/cyrus/bin/master -l 200 &
exit
fi
exit

[root@mailhost /root]# cat /root/check-pop.pl
#!/usr/bin/perl
use Net::POP3;

$pop = Net::POP3->new('localhost', Timeout => 60);

if ($pop) {
if ($pop->login ("cyrus", "passwordhere") ) {
        $pop->quit();
        exit(1);
}
}
exit(0);

And here is the line from my crontab:

00,15,30,45 * * * * /root/popcheck.sh

Please note that Cyrus usually takes a couple minutes to recover and start
accepting connections if it has to be restarted.  As mentioned above, the
server usually requires a restart about once a day.  Hope y'all find this
useful.  It reduces my user whining to a minimum...however it only gets so
good:-/

Regards
Mike


Reply via email to