Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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? – Evan Anderson Jun 24 '09 at 19:56
I'm not really sure what to look for in the logs (they're big) ... – Callmeed Jun 24 '09 at 22:32

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 {
    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.

share|improve this answer

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".

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).

share|improve this answer
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 file. There are files for pop3d and imapd, but not qmail. Any ideas? – Callmeed Jun 24 '09 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 '09 at 0:43
Yeah, I think something like this: IF FAILED myhost 25 PROTOCOL SMTP THEN restart – mibus Jun 26 '09 at 0:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.