From: Dragan Zubac on
Hello

I have two Postfix instances with configuration folders :

/etc/postfix
/etc/postfix-second

I start both instances by issuing the following commands :

postfix -c /etc/postfix start
postfix -c /etc/postfix-second start

I'm about to write a start/stop script for both instances,but I have a
problem because both of them using the following executable file :

/usr/lib/postfix/master

so when I type something like :

home:/etc/rc.d # pgrep -u root master
29967
1567

I got both instances pid files :

lsof -p 1567|grep pid
master 1567 root 9uW REG 8,7 33 67550
/var/spool/postfix-second/pid/master.pid

home:/etc/rc.d # lsof -p 29967|grep pid
master 29967 root 9uW REG 8,7 33 83715
/var/spool/postfix/pid/master.pid

Is there any Postfix way of uniquely distinguish between running
multiply instances of Postfix ? Or maybe some configurable option how to
name the 'master' process ,like 'master-second' ,'master-third' ,thus be
able to uniquely distinguish between them ?


Sincerely

Dragan Zubac

From: Wietse Venema on
Dragan Zubac:
> Hello
>
> I have two Postfix instances with configuration folders :
>
> /etc/postfix
> /etc/postfix-second
>
> I start both instances by issuing the following commands :
>
> postfix -c /etc/postfix start
> postfix -c /etc/postfix-second start
>
> I'm about to write a start/stop script for both instances,but I have a
> problem because both of them using the following executable file :
>
> /usr/lib/postfix/master
>
> so when I type something like :
>
> home:/etc/rc.d # pgrep -u root master
> 29967
> 1567
>
> I got both instances pid files :
>
> lsof -p 1567|grep pid
> master 1567 root 9uW REG 8,7 33 67550
> /var/spool/postfix-second/pid/master.pid
>
> home:/etc/rc.d # lsof -p 29967|grep pid
> master 29967 root 9uW REG 8,7 33 83715
> /var/spool/postfix/pid/master.pid
>
> Is there any Postfix way of uniquely distinguish between running
> multiply instances of Postfix ?

Use the CONTENT of the PID files.

Wietse

From: Victor Duchovni on
On Wed, Jun 16, 2010 at 11:41:12AM +0200, Dragan Zubac wrote:

> I start both instances by issuing the following commands :
>
> postfix -c /etc/postfix start
> postfix -c /etc/postfix-second start

Each is stopped by issuing:

postfix -c "$config_directory" stop

or via the postmulti(1) wrapper with Postfix 2.6 or later, which
can stop/start multiple instances via just "postfix start" and
"postfix stop" (no -c arguments). Recent Postfix versions also
support "postfix status" which shows the pid of each instance,
(but non-syslog output is suppressed when not a terminal...)

> Is there any Postfix way of uniquely distinguish between running
> multiply instances of Postfix ? Or maybe some configurable option how to
> name the 'master' process ,like 'master-second' ,'master-third' ,thus be
> able to uniquely distinguish between them ?

postmulti -i postfix-first -p start
postmulti -i postfix-first -p status
postmulti -i postfix-first -p stop

postmulti -i postfix-second -p start
postmulti -i postfix-second -p status
postmulti -i postfix-second -p stop

--
Viktor.

From: Dragan Zubac on
Hello

Thank You all for hints.
I did something else.

ln -s /usr/lib/postfix/master /usr/lib/postfix/master-second

Edit file : /etc/postfix-second/postfix-script , I changed all 'master'
to 'master-second',so :

postfix -c /etc/postfix-second stop

will not kill first instance only the second one. Now each of instances
has a different process name and can be matched uniquely.
Once I upgrade the Postfix,I'll change this scenario and use 'postmulti'
feature.

Sincerely

Dragan

On 06/16/10 14:57, Victor Duchovni wrote:
> On Wed, Jun 16, 2010 at 11:41:12AM +0200, Dragan Zubac wrote:
>
>
>> I start both instances by issuing the following commands :
>>
>> postfix -c /etc/postfix start
>> postfix -c /etc/postfix-second start
>>
> Each is stopped by issuing:
>
> postfix -c "$config_directory" stop
>
> or via the postmulti(1) wrapper with Postfix 2.6 or later, which
> can stop/start multiple instances via just "postfix start" and
> "postfix stop" (no -c arguments). Recent Postfix versions also
> support "postfix status" which shows the pid of each instance,
> (but non-syslog output is suppressed when not a terminal...)
>
>
>> Is there any Postfix way of uniquely distinguish between running
>> multiply instances of Postfix ? Or maybe some configurable option how to
>> name the 'master' process ,like 'master-second' ,'master-third' ,thus be
>> able to uniquely distinguish between them ?
>>
> postmulti -i postfix-first -p start
> postmulti -i postfix-first -p status
> postmulti -i postfix-first -p stop
>
> postmulti -i postfix-second -p start
> postmulti -i postfix-second -p status
> postmulti -i postfix-second -p stop
>
>

From: Wietse Venema on
Dragan Zubac:
> Hello
>
> Thank You all for hints.
> I did something else.
>
> ln -s /usr/lib/postfix/master /usr/lib/postfix/master-second

This is not needed. Without making ANY changes, "postfix -c
/etc/postfix-second stop" will stop only the second instance.

> Edit file : /etc/postfix-second/postfix-script , I changed all 'master'
> to 'master-second',so :
>
> postfix -c /etc/postfix-second stop

This is not needed. Without making ANY changes, "postfix -c
/etc/postfix-second stop" will stop only the second instance.

Wietse