On Friday, September 01, 2017 04:46:34 PM Raoul Gunnar Borenius wrote: > Package: postfix > Version: 3.2.2-1 > Severity: normal > Tags: patch > > Dear Maintainer, > > * What led up to the situation? > > trying to use multiple instances as stated in README.Debian. > > * What exactly did you do (or not do) that was effective (or > ineffective)? > > systemctl enable postfix@myinstance.service > systemctl start postfix > > * What was the outcome of this action? > > only the 'main' Postfix instance was started > > * What outcome did you expect instead? > > the instance 'myinstance' should also have been started > (at least that's how I understand README.Debian) > > The following fix worked for me: > > ------------------------------------------------------------------------- > --- /lib/systemd/system/post...@.service.orig 2017-06-17 > 19:57:19.000000000 +0200 +++ /lib/systemd/system/postfix@.service > 2017-09-01 16:18:43.569388300 +0200 @@ -16,4 +16,4 @@ > ExecReload=/usr/sbin/postmulti -i %i -p reload > > [Install] > -WantedBy=multi-user.target > +WantedBy=postfix.service > ------------------------------------------------------------------------- > > Now 'systemctl start postfix' starts and stops all enabled instances > of postfix. > > > However digging deeper into the possibilities of systemd there seems to > be an even better way to handle multiple instances! > > Provided with postfix is a systemd-generator file in > /lib/systemd/system-generators/postfix-instance-generator > which takes care of the multi instance handling. > At first it did not work for me but applying this small change: > > ------------------------------------------------------------------------- > --- /lib/systemd/system-generators/postfix-instance-generator.orig > 2017-06-17 20:10:34.000000000 +0200 +++ > /lib/systemd/system-generators/postfix-instance-generator 2017-09-01 > 16:24:54.723601375 +0200 @@ -7,7 +7,7 @@ > > mkdir -p "$WANTDIR" > > -if [ -f main.cf ]; then > +if [ -f /etc/postfix/main.cf ]; then > for NAME in $(postmulti -l -a | awk '{ print $1}'); do > ln -s "$SERVICEFILE" "$WANTDIR/postfix@$NAME.service" > done > ------------------------------------------------------------------------- > > makes it behave as expected for me. It then creates symlinks in > /run/systemd/generator/postfix.service.wants/... > which makes the 'systemd enable postfix@myinstance.service' > command completely unnecessary. > > Would be nice to have that alternative documented in README.Debian, > maybe even replacing the 'enable' variant because for me it looks > more elegant. > > Thanks for considering applying my patches and your time > in maintaining the postifx package!
The change in postfix-instance-generator should be all that's needed. Once that's fixed, I don't think the wanted-by change is needed as the global postfix.service already controls all instances through the PartOf field. Scott K P.S. Thanks to Raphael Hertzog <hert...@debian.org> for reviewing the proposed patch for me.