{
    "mode": "man",
    "parameter": "POSTFIX-WRAPPER",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/POSTFIX-WRAPPER/5/json",
    "generated": "2026-10-06T01:57:21Z",
    "sections": {
        "NAME": {
            "content": "postfix-wrapper - Postfix multi-instance API\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Support  for  managing  multiple  Postfix instances is available as of version 2.6. Instances\nshare executable files and documentation, but have their own directories  for  configuration,\nqueue and data files.\n\nThis  document  describes how the familiar \"postfix start\" etc. user interface can be used to\nmanage one or multiple Postfix instances, and gives details of an API to  coordinate  activi‐\nties between the postfix(1) command and a multi-instance manager program.\n\nWith  multi-instance  support, the default Postfix instance is always required. This instance\nis identified by the configdirectory parameter's default value.\n",
            "subsections": []
        },
        "GENERAL OPERATION": {
            "content": "Multi-instance support is backwards compatible: when you run only one Postfix instance,  com‐\nmands such as \"postfix start\" will not change behavior at all.\n\nEven  with  multiple  Postfix instances, you can keep using the same postfix commands in boot\nscripts, upgrade procedures, and other places. The commands do more work, but humans are  not\nforced to learn new tricks.\n\nFor example, to start all Postfix instances, use:\n\n# postfix start\n\nOther  postfix(1)  commands  also work as expected. For example, to find out what Postfix in‐\nstances exist in a multi-instance configuration, use:\n\n# postfix status\n\nThis enumerates the status of all Postfix instances within a multi-instance configuration.\n",
            "subsections": []
        },
        "MANAGING AN INDIVIDUAL POSTFIX INSTANCE": {
            "content": "To manage a specific Postfix instance, specify its configuration directory on the  postfix(1)\ncommand line:\n\n# postfix -c /path/to/configdirectory command\n\nAlternatively,  the postfix(1) command accepts the instance's configuration directory via the\nMAILCONFIG environment variable (the -c command-line option has higher precedence).\n\nOtherwise, the postfix(1) command will operate on all Postfix instances.\n\nENABLING POSTFIX(1) MULTI-INSTANCE MODE\nBy default, the postfix(1) command operates in single-instance mode. In this mode the command\ninvokes the postfix-script file directly (currently installed in the daemon directory).  This\nfile contains the commands that start or stop one Postfix instance, that upgrade the configu‐\nration of one Postfix instance, and so on.\n\nWhen the postfix(1) command operates in multi-instance mode as discussed below,  the  command\nneeds  to execute start, stop, etc.  commands for each Postfix instance.  This multiplication\nof commands is handled by a multi-instance manager program.\n\nTurning on postfix(1) multi-instance mode goes as follows: in the default Postfix  instance's\nmain.cf  file, 1) specify the pathname of a multi-instance manager program with the multiin‐\nstancewrapper parameter; 2) populate the multiinstancedirectories parameter with the  con‐\nfiguration directory pathnames of additional Postfix instances.  For example:\n\n/etc/postfix/main.cf:\nmultiinstancewrapper = $daemondirectory/postfix-wrapper\nmultiinstancedirectories = /etc/postfix-test\n\nThe  $daemondirectory/postfix-wrapper file implements a simple manager and contains instruc‐\ntions for creating Postfix instances by hand.  The postmulti(1) command provides a  more  ex‐\ntensive implementation including support for life-cycle management.\n\nThe  multiinstancedirectories and other main.cf parameters are listed below in the CONFIGU‐\nRATION PARAMETERS section.\n\nIn multi-instance mode, the postfix(1) command invokes  the  $multiinstancewrapper  command\ninstead  of  the  postfix-script file. This multi-instance manager in turn executes the post‐\nfix(1) command in single-instance mode for each Postfix instance.\n\nTo illustrate the main ideas behind multi-instance operation, below is an example of a simple\nbut useful multi-instance manager implementation:\n\n#!/bin/sh\n\n: ${commanddirectory?\"do not invoke this command directly\"}\n\nPOSTCONF=$commanddirectory/postconf\nPOSTFIX=$commanddirectory/postfix\ninstancedirs=`$POSTCONF -h multiinstancedirectories |\nsed 's/,/ /'` || exit 1\n\nerr=0\nfor dir in $configdirectory $instancedirs\ndo\ncase \"$1\" in\nstop|abort|flush|reload|drain)\ntest \"`$POSTCONF -c $dir -h multiinstanceenable`\" \\\n= yes || continue;;\nstart)\ntest \"`$POSTCONF -c $dir -h multiinstanceenable`\" \\\n= yes || {\n$POSTFIX -c $dir check || err=$?\ncontinue\n};;\nesac\n$POSTFIX -c $dir \"$@\" || err=$?\ndone\n\nexit $err\n",
            "subsections": []
        },
        "PER-INSTANCE MULTI-INSTANCE MANAGER CONTROLS": {
            "content": "Each Postfix instance has its own main.cf file with parameters that control how the multi-in‐\nstance manager operates on that instance.  This section discusses  the  most  important  set‐\ntings.\n\nThe  setting  \"multiinstanceenable = yes\" allows the multi-instance manager to start (stop,\netc.) the corresponding Postfix instance. For safety reasons, this setting  is  not  the  de‐\nfault.\n\nThe  default  setting \"multiinstanceenable = no\" is useful for manual testing with \"postfix\n-c /path/name start\" etc.  The multi-instance manager will not start such an instance, and it\nwill skip commands such as \"stop\" or \"flush\" that require a running  Postfix  instance.   The\nmulti-instance  manager  will  execute  commands  such  as \"check\", \"set-permissions\" or \"up‐\ngrade-configuration\", and it will replace \"start\" by \"check\" so that  problems  will  be  re‐\nported even when the instance is disabled.\n",
            "subsections": []
        },
        "MAINTAINING SHARED AND NON-SHARED FILES": {
            "content": "Some  files  are shared between Postfix instances, such as executables and manpages, and some\nfiles are per-instance, such as configuration files, mail queue files, and data  files.   See\nthe NON-SHARED FILES section below for a list of per-instance files.\n\nBefore  Postfix multi-instance support was implemented, the executables, manpages, etc., have\nalways been maintained as part of the default Postfix instance.\n\nWith multi-instance support, we simply continue to do this.  Specifically, a Postfix instance\nwill not check or update shared files when that instance's configdirectory value  is  listed\nwith the default main.cf file's multiinstancedirectories parameter.\n\nThe  consequence  of this approach is that the default Postfix instance should be checked and\nupdated before any other instances.\n",
            "subsections": []
        },
        "MULTI-INSTANCE API SUMMARY": {
            "content": "Only the multi-instance manager implements support for the  multiinstanceenable  configura‐\ntion  parameter.  The  multi-instance manager will start only Postfix instances whose main.cf\nfile has \"multiinstanceenable = yes\". A setting of \"no\" allows a  Postfix  instance  to  be\ntested by hand.\n\nThe postfix(1) command operates on only one Postfix instance when the -c option is specified,\nor when MAILCONFIG is present in the process environment. This is necessary to terminate re‐\ncursion.\n\nOtherwise,  when  the multiinstancedirectories parameter value is non-empty, the postfix(1)\ncommand executes the command specified with the multiinstancewrapper parameter, instead  of\nexecuting the commands in postfix-script.\n\nThe  multi-instance  manager skips commands such as \"stop\" or \"reload\" that require a running\nPostfix instance, when an instance does not have \"multiinstanceenable = yes\".  This  avoids\nfalse error messages.\n\nThe  multi-instance  manager  replaces a \"start\" command by \"check\" when a Postfix instance's\nmain.cf file does not have \"multiinstanceenable =  yes\".  This  substitution  ensures  that\nproblems will be reported even when the instance is disabled.\n\nNo  Postfix  command  or  script  will update or check shared files when its configdirectory\nvalue is listed in the default main.cf's multiinstancedirectories parameter value.   There‐\nfore,  the  default  instance should be checked and updated before any Postfix instances that\ndepend on it.\n\nSet-gid commands such as  postdrop(1)  and  postqueue(1)  effectively  append  the  multiin‐\nstancedirectories  parameter  value  to  the  legacy  alternateconfigdirectories parameter\nvalue. The commands use this information to determine whether a -c option or MAILCONFIG  en‐\nvironment setting specifies a legitimate value.\n\nThe  legacy  alternateconfigdirectories parameter remains necessary for non-default Postfix\ninstances that are running different versions of Postfix, or that are  not  managed  together\nwith the default Postfix instance.\n",
            "subsections": []
        },
        "ENVIRONMENT VARIABLES": {
            "content": "MAILCONFIG\nWhen  present,  this  forces  the  postfix(1) command to operate only on the specified\nPostfix instance. This environment variable is exported by the postfix(1)  -c  option,\nso that postfix(1) commands in descendant processes will work correctly.\n",
            "subsections": []
        },
        "CONFIGURATION PARAMETERS": {
            "content": "The text below provides only a parameter summary. See postconf(5) for more details.\n",
            "subsections": [
                {
                    "name": "multi_instance_directories (empty)",
                    "content": "An  optional  list of non-default Postfix configuration directories; these directories\nbelong to additional Postfix instances that share the  Postfix  executable  files  and\ndocumentation  with the default Postfix instance, and that are started, stopped, etc.,\ntogether with the default Postfix instance.\n"
                },
                {
                    "name": "multi_instance_wrapper (empty)",
                    "content": "The pathname of a multi-instance manager command that the postfix(1)  command  invokes\nwhen the multiinstancedirectories parameter value is non-empty.\n"
                },
                {
                    "name": "multi_instance_name (empty)",
                    "content": "The optional instance name of this Postfix instance.\n"
                },
                {
                    "name": "multi_instance_group (empty)",
                    "content": "The optional instance group name of this Postfix instance.\n"
                },
                {
                    "name": "multi_instance_enable (no)",
                    "content": "Allow this Postfix instance to be started, stopped, etc., by a multi-instance manager.\n"
                }
            ]
        },
        "NON-SHARED FILES": {
            "content": "",
            "subsections": [
                {
                    "name": "config_directory (see 'postconf -d' output)",
                    "content": "The default location of the Postfix main.cf and master.cf configuration files.\n"
                },
                {
                    "name": "data_directory (see 'postconf -d' output)",
                    "content": "The  directory  with  Postfix-writable  data files (for example: caches, pseudo-random\nnumbers).\n"
                },
                {
                    "name": "queue_directory (see 'postconf -d' output)",
                    "content": "The location of the Postfix top-level queue directory.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "postfix(1) Postfix control program\npostmulti(1) full-blown multi-instance manager\n$daemondirectory/postfix-wrapper simple multi-instance manager\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "The Secure Mailer license must be distributed with this software.\n\nAUTHOR(S)\nWietse Venema\nIBM T.J. Watson Research\nP.O. Box 704\nYorktown Heights, NY 10598, USA\n\nWietse Venema\nGoogle, Inc.\n111 8th Avenue\nNew York, NY 10011, USA\n\nPOSTFIX-WRAPPER(5)",
            "subsections": []
        }
    },
    "summary": "postfix-wrapper - Postfix multi-instance API",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "postfix",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/postfix/1/json"
        },
        {
            "name": "postmulti",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/postmulti/1/json"
        }
    ]
}