stop receiving mail but keep processing mail in queue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

stop receiving mail but keep processing mail in queue

Rosenbaum, Larry M.

How would we set Postfix to stop accepting incoming mail yet keep processing any queued mail? We are migrating from RHEL6 physical to RHEL7 virtual. Postfix version 3.2.2.

 

Also, can we copy the queue over?

 

Thanks,

 

Larry M. Rosenbaum

Oak Ridge National Laboratory

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: stop receiving mail but keep processing mail in queue

Benny Pedersen-2
Rosenbaum, Larry M. skrev den 2017-09-14 17:40:
> How would we set Postfix to stop accepting incoming mail yet keep
> processing any queued mail?

google postfix loopback only

main.cf:

inet_interfaces = loopback-only

postfix reload
Reply | Threaded
Open this post in threaded view
|

Re: stop receiving mail but keep processing mail in queue

Viktor Dukhovni
On Thu, Sep 14, 2017 at 06:02:55PM +0200, Benny Pedersen wrote:

> Rosenbaum, Larry M. skrev den 2017-09-14 17:40:
> > How would we set Postfix to stop accepting incoming mail yet keep
> > processing any queued mail?
>
> google postfix loopback only
>
> main.cf:
>
> inet_interfaces = loopback-only
>
> postfix reload

The inet_interfaces parameter is one of the few that requires
a restart rather than a reload when it is changed in order to
change the listener sockets associated with master.cf inet
services.

    http://www.postfix.org/postconf.5.html#inet_interfaces

So that would be:

   # postfix stop
   # postfix start

A less invasive change is:

    # postconf -e "master_service_disable = inet"
    # postfix reload

Because this disables the inet services, rather than attempts to
change the underlying sockets, it does not require a restart, and
the queue manager and outbound deliveries continue without
interruption.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

RE: stop receiving mail but keep processing mail in queue

Rosenbaum, Larry M.
Thanks!

> -----Original Message-----
> From: [hidden email] [mailto:owner-postfix-
> [hidden email]] On Behalf Of Viktor Dukhovni
> Sent: Thursday, September 14, 2017 8:22 PM
> To: [hidden email]
> Subject: Re: stop receiving mail but keep processing mail in queue
>
> On Thu, Sep 14, 2017 at 06:02:55PM +0200, Benny Pedersen wrote:
>
> > Rosenbaum, Larry M. skrev den 2017-09-14 17:40:
> > > How would we set Postfix to stop accepting incoming mail yet keep
> > > processing any queued mail?
> >
> > google postfix loopback only
> >
> > main.cf:
> >
> > inet_interfaces = loopback-only
> >
> > postfix reload
>
> The inet_interfaces parameter is one of the few that requires
> a restart rather than a reload when it is changed in order to
> change the listener sockets associated with master.cf inet
> services.
>
>     http://www.postfix.org/postconf.5.html#inet_interfaces
>
> So that would be:
>
>    # postfix stop
>    # postfix start
>
> A less invasive change is:
>
>     # postconf -e "master_service_disable = inet"
>     # postfix reload
>
> Because this disables the inet services, rather than attempts to
> change the underlying sockets, it does not require a restart, and
> the queue manager and outbound deliveries continue without
> interruption.
>
> --
> Viktor.

Reply | Threaded
Open this post in threaded view
|

RE: stop receiving mail but keep processing mail in queue

Rosenbaum, Larry M.
In reply to this post by Viktor Dukhovni
> From: [hidden email] [mailto:owner-postfix-
> [hidden email]] On Behalf Of Viktor Dukhovni
...

>
> A less invasive change is:
>
>     # postconf -e "master_service_disable = inet"
>     # postfix reload
>
> Because this disables the inet services, rather than attempts to
> change the underlying sockets, it does not require a restart, and
> the queue manager and outbound deliveries continue without
> interruption.

Excellent, thanks!

Is there a way to copy the deferred queue from the old server to the new one?
(we have long queue-IDs enabled)


Larry M. Rosenbaum
Oak Ridge National Laboratory


Reply | Threaded
Open this post in threaded view
|

Re: stop receiving mail but keep processing mail in queue

Viktor Dukhovni
On Fri, Sep 15, 2017 at 06:37:09PM +0000, Rosenbaum, Larry M. wrote:

> > From: [hidden email] [mailto:owner-postfix-
> > [hidden email]] On Behalf Of Viktor Dukhovni
> ...
> >
> > A less invasive change is:
> >
> >     # postconf -e "master_service_disable = inet"
> >     # postfix reload
> >
> > Because this disables the inet services, rather than attempts to
> > change the underlying sockets, it does not require a restart, and
> > the queue manager and outbound deliveries continue without
> > interruption.

Fulll disclosure, the outbound smtp(8) agents complete current
deliveries and restart, while the queue manager also restarts
gracefully, but there is some churn of mail from active -> incoming ->
active again.

> Excellent, thanks!
>
> Is there a way to copy the deferred queue from the old server to the new one?
> (we have long queue-IDs enabled)

The simplest thing is to carefully set the "relayhost" of the old
server to the new, after making sure the new will accept outbound
relaying from the old.  Then the queue drains quickly over SMTP.

Moving queue files is doable, but tricky.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

RE: stop receiving mail but keep processing mail in queue

Rosenbaum, Larry M.
> From: [hidden email] [mailto:owner-postfix-
> [hidden email]] On Behalf Of Viktor Dukhovni
> Is there a way to copy the deferred queue from the old server to the new
> one?
> > (we have long queue-IDs enabled)
>
> The simplest thing is to carefully set the "relayhost" of the old
> server to the new, after making sure the new will accept outbound
> relaying from the old.  Then the queue drains quickly over SMTP.
>
> Moving queue files is doable, but tricky.

I expect the old system to be unavailable after the switch. How
would we move the queue files?
Reply | Threaded
Open this post in threaded view
|

Re: stop receiving mail but keep processing mail in queue

Viktor Dukhovni

> On Sep 20, 2017, at 9:31 AM, Rosenbaum, Larry M. <[hidden email]> wrote:
>
> I expect the old system to be unavailable after the switch. How
> would we move the queue files?

When possible, plan to allow the two to coexist during the transition.

In any case, to move the queue files (from the default Postfix
instance, otherwise repeat per non-default instance):

    # : on old server
    # postfix stop
   
    :  archive queue files from the default Postfix instance,
    :  on multi-instance servers repeat per non-default instance
    :
    # export MAIL_CONFIG=$(postconf -d config_directory)
    # name=$(postconf -xh syslog_name)
   
    # postsuper -h ALL
    # cd $(postconf -xh queue_directory)
    # umask 077
    # t=$(mktemp "/tmp/${name}-hold.tgz.XXXXXX")
    # tar czvf "$t" hold && mv "$t" "/tmp/${name}-hold.tgz"

Copy the tarball off the old server, stored not world-readable.
It is assumed below that either your new servers has an empty
"hold" queue, or you're willing to "release" any queue files
found there.

    # : on new server
    # : copy all the tarballs safely to a suitable directory
    # : and "cd" there
    # postfix stop

    # : per Postfix instance
    # export MAIL_CONFIG=$(postconf -d config_directory)
    # name=$(postconf -xh syslog_name)

    # qdir=$(postconf -xh queue_directory)
    # mail_owner=$(postconf -xh mail_owner)
    # postsuper -H ALL
    # (cd "${qdir}"; tar xzvf -) < "${name}-hold.tgz"
    # chown -R "${mail_owner}" "${qdir}/hold"

    # : repeat "postsuper -s" until it reports no further renames
    # postsuper -s

    # : release queue files from merged "hold" queue
    # postsuper -H ALL

    # : Make sure queue content looks OK
    # mailq

    # : repeat steps above for any other instances

    # : Finally start all the instances.
    # postfix start
   
--
        Viktor.