0

On one of our Linux servers (running Plesk for basic hosting), QMail crashes/shuts down and all users on the server can't get mail.

This happens about 2 or 3 times a week. No other services are affected (apache keeps humming along just fine).

What are some options for checking/restarting QMail in this scenario? Some sort of cron job–or perhaps install ruby and god?

2
  • 2
    I'd be concerned about getting to the bottom of why qmail is crashing. Yeah, you can restart it over and over again, but there's a reason why it's failing to begin with. Are you seeing anything logged when it's crashing? Jun 24, 2009 at 19:56
  • I'm not really sure what to look for in the logs (they're big) ...
    – Callmeed
    Jun 24, 2009 at 22:32

2 Answers 2

1

The DJB way would be to use daemontools. Specifically, supervise.

At my site, I'd be using puppet, which checks on all puppet-managed services every half hour and starts them back up if they've died for some reason. Something like:

service {
  "qmail":
    ensure => running,
    enable => true,
    require => Package["qmail"];
}

But more importantly: find out why it's dying, and stop it from doing that. Seriously. Or switch to a mailer daemon that doesn't die on you. I recommend postfix or exim.

1

daemontools is a good option.

Another one - that doesn't involve changing the way your service starts, and thus might be easier to add in to production, is "monit".

http://mmonit.com/monit/

You can also set up how many times it should restart and other actions that it should do at the same time (eg. fire off an email to an email/SMS gateway).

3
  • Thanks, I actually just installed monit ... problem is, qmail doesn't seem to have a .pid file in /var/run ... so monit has no way of checking if its running. At least, there's no qmail.pid file. There are files for pop3d and imapd, but not qmail. Any ideas?
    – Callmeed
    Jun 24, 2009 at 23:27
  • I'm afraid I stopped using it over a year ago (change of jobs, we have much more advanced stuff here) and can't remember. You should be able to set up a TCP check against port 25, and trigger on that (instead of the process existing).
    – mibus
    Jun 26, 2009 at 0:43
  • Yeah, I think something like this: IF FAILED myhost 25 PROTOCOL SMTP THEN restart mmonit.com/monit/documentation/monit.html#connection_testing
    – mibus
    Jun 26, 2009 at 0:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .