Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have some monitoring scripts on a couple of servers checking stuff that's not too critical (but that I indeed would like to receive email alerts for).

I use Postfix and my SMTP-to-SMS email address so that I can receive these notification on my cell phone. My problem is: I don't want to receive these alerts at dawn when I'm sleeping :(

I know I could modify my scripts in order to accomplish this but I decided that the best way to do this is to change postfix (since it isn't being used for anything else). How can I make postfix "put on hold" all new "incoming" messages, let say from 11pm to 6am? And then later at 6am flush that queue?

Thanks, JFA

share|improve this question
Well the obvious and most simple way would be to have cron do '/etc/init.d/postfix stop' at 11pm and '/etc/init.d/postfix start' at 6am. But there will be much better ways of doing it. If it's not critical, then why have it delivered to your cellphone in the first place - why not just have it sent to your email account. – kaerast Jan 13 '10 at 1:19
Hi. No...that won't work as my interface to the email system is via the /bin/mail command ...and if there is no MTA running it will fail. As I mentioned, I know I could change the timing thing on scripts but for other reasons I need to leave them like that ...and all messages generated at dawn should be indeed queued (but in "hold") until 6am that I want the MTA to flush them. There's got to be a way to put postfix in just-put-on-hold 'mode... – JFA Jan 13 '10 at 1:32
That's the best way you can think of? – womble Jan 13 '10 at 1:45

Here's a crazy idea, but why don't you go ahead and change the notification? What is sending out the error?

Most monitoring systems allow you to specify the time span you want to be alerted during. I would work on it from that end, since disabling the mail daemon to stop a client from sending mail is backwards.

Change that which has the least effect.

share|improve this answer

Here is the reply I read on the postfix mailing list, from Wietse, the creator of postfix:

If you want to be really sure, use an access rule for new mail like:


and execute "postsuper -h ALL" for mail that is already in the queue. That freezes it in the queue.

What to do is to add this line at night time by a cron job in the file and reload postfix (postfix reload) afterwards. At day time delete or comment it and don't forget to free up all mails hold with something like postsuper -H ALL at the same time.

share|improve this answer

One of the nice things about postfix is that you can alter the running configuration and reload it pretty easily via the postconf -e and postfix reload commands

Otherwise, I'd suggest a cron script that blackhole routes your SMS gateway's IP address, which would force the system to queue until morning.

share|improve this answer

Your Answer


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