Exim dying, not sure why?

flamewalker

Verified User
Joined
Aug 21, 2007
Messages
64
I have a VPS with Directadmin on it, and the server has been having some serious up and down issues lately. Every time it comes back up, Exim dies at least a couple times. The last time I found a log entry, something about not being able to read the delivery status.

At any rate, I have a script that checks if exim is running, if not, restart. However, it doesn't seem to be able to detect the fact that exim is dying but the pid file remains.

Code:
#!/bin/bash
progname=exim
[email protected]
[email protected]
[email protected]

if [ "$(/sbin/pidof $progname)" = "" ]; then
        /etc/rc.d/init.d/exim start;
        mail -s "$progname on $(hostname) restarted at $(date)" $email < .;
        mail -s "$progname on $(hostname) restarted at $(date)" $email2 < .;
        mail -s "$progname on $(hostname) restarted at $(date)" $email3 < .;
fi

Any tips to modify my code so that it can check if the program is actually running, regardless if the pid file exists, so it can restart it?

The last log file when it crashed, in paniclog:

Code:
2012-12-20 09:52:43 1TlkGc-0008Qg-Av failed to read delivery status for [email protected] from delivery subprocess

Thanks in advance!

PS - it hasn't crashed since then. But if/when the server goes down again, I want to make sure exim will keep restarting until I can troubleshoot it. Usually its a bayes file that was open when the server crashed :mad:
 
Hello,

First of all it's directadmin who monitors the services like exim, apache, dovecot, etc and restarts any of them if any stops. If directadmin fails to start a service several times, then you'll get an alert email. So why do you want extra script to do the same for exim only? If you really need a third party software for monitoring your service in this case you should not rely on existence of a pid file. You should check whether you have a running instance in the memory and check its status and probably do some telneting on order to understand whether a daemon is responding to commands. A ready made software monit you might want to use for that.

This is about monit:

Monit is a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

http://mmonit.com/monit/
 
Back
Top