On Tue, 11 Feb 2020 20:34:33 +0100 jaros...@thinline.cz wrote: ... > Hello, > > thanks for putting your time into this. > > If it helps, I made a quick and dirty fix to the new approach > > running() { > > INSTANCE="$1" > if [ "X$INSTANCE" = X ]; then > > POSTMULTI="" > > else > > POSTMULTI="postmulti -i $INSTANCE -x " > > fi > POSTCONF="${POSTMULTI} postconf" > > daemon_directory=$($POSTCONF -hx daemon_directory 2>/dev/null || > > echo /usr/lib/postfix/sbin) > > if ! ${POSTMULTI} $daemon_directory/master -t 2>/dev/null ; then > > echo y > > fi > > } > > This way postmulti calls master (or any program) with some environment > variables set, namely [1]: > > MAIL_LOGTAG=postfix > MAIL_CONFIG=/etc/postfix-fwd > daemon_directory=/usr/lib/postfix/sbin > command_directory=/usr/sbin > config_directory=/etc/postfix-fwd > queue_directory=/var/spool/postfix-fwd > data_directory=/var/lib/postfix-fwd > multi_instance_name=postfix-fwd > multi_instance_group= > multi_instance_enable=yes > > Apparently master process uses these and does the right thing, ie. looks > for the pidfile in correct directory - see strace: > > [pid 8180] chdir("/var/spool/postfix-fwd") = 0 > [pid 8180] access("pid/master.pid", F_OK) = 0 > > I admit I have no idea whatsoever if this approach is correct, > documented or supported. Just occured to me it might work and it did. > > [1] postmulti -i postfix-fwd -x cat /proc/self/environ | tr "\0" "\n"
I've verified this works for a single instance still (no reason it shouldn't) and researched it a bit. I think this is actually quite reasonable. Thanks. Unless someone can find a problem or has a better idea, I'll go with this on the next upload. Scott K
signature.asc
Description: This is a digitally signed message part.