Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We do a relay to another server which we use only for sending mails. Since we send a lot of mails daily (no spam), the relaying server's postfix tends to crash (I'm not that technical in this matter to know how to give you more info on this), and I have to restart the service.

Now, I'm wondering what could I do in order to check the postfix service on the relaying server every "now and then" to see if it's running - and if not have it send me an email with the error, or maybe even potentially (if this is possible) restart the postfix service automaticaly.

Sure, I know I should "write a script to do that" - but actually here I'm stuck - what script, which language, etc - any help is appreciated.

share|improve this question
3  
Wow. Postfix crashing? Then you must send very much e-mail. Do you send something like million mails per minute around the clock? :) You truly should let someone investigate your Postfix/CentOS setup, something's wrong if Postfix regularly crashes. It's one of the most reliable workhorses I've seen. –  Janne Pikkarainen May 31 '12 at 8:23
    
@JannePikkarainen: no, we don't send millions, we send about 50k in 3 hours. –  Nikola May 31 '12 at 8:30
    
That's definitely not a lot of e-mail. It's about 5 e-mails per second and no, that should not hurt even your grandma's 486DX2/66 MHz. :-) So something's fundamentally wrong. Do you know if your Postfix uses something like a database for recipient address mapping? –  Janne Pikkarainen May 31 '12 at 8:34
    
@JannePikkarainen: actually, I would say no. This server is just as a "relay" so all it does is it takes the mail sent from our "new" server and sends it (if I understood the terminology right). The reson we kept the "old" one (this relaying one) is because it has good IP rep. –  Nikola May 31 '12 at 11:12
    
If you're not that technical, I'd recommend getting someone who is that technical in to fix it. We're not going to be able to teach you how to debug segfaults. –  womble Jul 4 '12 at 5:56

1 Answer 1

up vote 4 down vote accepted

You can use monit. It is a nice tool to monitor your running process and can take specific actions like restarting the service and alerting you by sending an email, etc..

share|improve this answer
1  
I'd add that using Monit is a good idea just for monitoring's sake, but really...Postfix shouldn't be crashing like that. In this particular use case it sounds like a band aid over a bigger problem that should be focused on fixing. –  Bart Silverstrim May 31 '12 at 13:26
    
@BartSilverstrim: I totally agree with you. Monit should not be used as a solution for a continuously crashing process. –  Khaled May 31 '12 at 13:31

Your Answer

 
discard

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.