POSTMULTI(1)
β¨ POSTMULTI(1) β¨
okay bestie, gather round, because this is postmulti β the Postfix multi-instance manager, living its best life in the General Commands Manual section. π
πΈ NAME πΈ
postmulti β Postfix multi-instance manager
π SYNOPSIS π
Enabling multi-instance management:
postmulti -e init [-v]
Iterator mode:
postmulti -l [-ajRv] [-g group] [-i name]
postmulti -p [-av] [-g group] [-i name] postfix-command...
postmulti -x [-aRv] [-g group] [-i name] unix-command...
Life-cycle management:
postmulti -e create [-av] [-g group] [-i name] [-G group] [-I name]
[param=value ...]
postmulti -e import [-av] [-g group] [-i name] [-G group] [-I name]
[config_directory=/path]
postmulti -e destroy [-v] -i name
postmulti -e deport [-v] -i name
postmulti -e enable [-v] -i name
postmulti -e disable [-v] -i name
postmulti -e assign [-v] -i name [-I name] [-G group]
π¦ DESCRIPTION π¦
So postmulti(1) is THE tool that lets a Postfix administrator run and wrangle multiple Postfix instances on one single host. one host, many instances, zero chaos (ideally). β¨
And here's the tea: postmulti(1) has two fundamental modes of operation:
- iterator mode β it runs the same command across multiple Postfix instances, one after another. group chat energy. π
- life-cycle management mode β it adds or deletes a single instance, or flips the multi-instance status of a single instance.
Each mode has its own command syntax, which is exactly why each mode gets its own section down below. no mixing, no confusion, periodt. π
π BACKGROUND π
A multi-instance configuration is made of one primary Postfix instance, plus one or more secondary instances whose configuration directory pathnames get recorded in the primary instance's main.cf file. All the Postfix instances share program files and documentation, but each one has its own configuration, queue and data directories. sharing is caring, except for config. π
Now, the important caveat, no cap: currently, only the default Postfix instance can be used as the primary instance in a multi-instance configuration. The postmulti(1) command does not currently support a -c option to select an alternative primary instance, and it exits with a fatal error if the MAIL_CONFIG environment variable is set to a non-default configuration directory. so don't try it bestie, it will simply pass away. π
If you want the full deep-dive discussion of multi-instance management withpostmulti(1), go read theMULTI_INSTANCE_READMEtutorial. it's giving required reading. π
β ITERATOR MODE β
In iterator mode, postmulti performs the same operation on all Postfix instances, in turn.
Small but mighty detail: if multi-instance support is not enabled, the requested command is performed just for the primary instance. simple life. π«Ά
Iterator mode implements the following command options:
π Instance selection π
-aβ Perform the operation on all instances. This is the default.-ggroup β Perform the operation only for members of the named group.-iname β Perform the operation only for the instance with the specified name. You can specify either the instance name or the absolute pathname of the instance's configuration directory. Specify"-"to select the primary Postfix instance.-Rβ Reverse the iteration order. This may be appropriate when updating a multi-instance system, where "sink" instances are started before "source" instances.
This option cannot be used with -p.
π List mode π
-jβ Produce JSON output. See JSON OBJECT FORMAT below.
This feature is available in Postfix version 3.11 and later.
-lβ List Postfix instances with their instance name, instance group name, enable/disable status and configuration directory.
π§ Postfix-wrapper mode π§
-ppostfix-command β Invokepostfix(1)to execute postfix-command. This option implements thepostfix-wrapper(5)interface.- With "start"-like commands,
"postfix check"is executed for instances that are not enabled. The full list of commands is specified with thepostmulti_start_commandsparameter. - With "stop"-like commands, the iteration order is reversed, and disabled instances are skipped. The full list of commands is specified with the
postmulti_stop_commandsparameter. - With "reload" and other commands that require a started instance, disabled instances are skipped. The full list of commands is specified with the
postmulti_control_commandsparameter. - With "status" and other commands that don't require a started instance, the command is executed for all instances.
- With "start"-like commands,
The -p option can also be used interactively to start/stop/etc. a named instance or instance group. For example, to start just the instances in the group "msa", invoke postmulti(1) as follows:
# postmulti -g msa -p start
π Command mode π
-xunix-command β Execute the specified unix-command for all Postfix instances. The command runs with appropriate environment settings forMAIL_CONFIG,command_directory,daemon_directory,config_directory,queue_directory,data_directory,multi_instance_name,multi_instance_groupandmulti_instance_enable.
πΈ Other options πΈ
-vβ Enable verbose logging for debugging purposes. Multiple-voptions make the software increasingly verbose.
π LIFE-CYCLE MANAGEMENT MODE π
With the -e option, postmulti(1) can be used to add or delete a Postfix instance, and to manage the multi-instance status of an existing instance. glow-up management, honestly. β¨
The following options are implemented:
π Existing instance selection π
-aβ When creating or importing an instance, place the new instance at the front of the secondary instance list.-ggroup β When creating or importing an instance, place the new instance before the first secondary instance that is a member of the specified group.-iname β When creating or importing an instance, place the new instance before the matching secondary instance.
With other life-cycle operations, apply the operation to the named existing instance. Specify "-" to select the primary Postfix instance.
π New or existing instance name assignment π
-Iname β Assign the specified instance name to an existing instance, newly-created instance, or imported instance. Instance names other than"-"(which makes the instance "nameless") must start with"postfix-". This restriction reduces the likelihood of name collisions with system files.-Ggroup β Assign the specified group name to an existing instance or to a newly created or imported instance.
and that's where part 1 wraps... but hold on, bestie, we're not done yet β more of this page is coming right up. π
okay so listen bestie π this next bit is literally the main character of the whole page: actually creating, deleting and toggling instances. buckle up π
πΈ Instance creation/deletion/status change πΈ
-e actionβ this is the "edit" hook for all your managed instances, and the actions you can throw at it are these πinitβ required first!! beforepostmulti(1)can manage anything at all. Thepostmulti -e initcommand updates the primary instance'smain.cffile, and it does that by setting:
multi_instance_wrapper =
${command_directory}/postmulti -p --
multi_instance_enable = yes
and ngl if you'd rather set those yourself some other way, go off, that's totally allowed π«Ά
createβ makes a brand-new Postfix instance and adds it to themulti_instance_directoriesparameter of the primary instance. The-I nameoption is what she recommends, bestie β it gives the instance a short name, and that name is used to construct the default values for the new instance's private directories. You can also pass the-G groupoption to put the instance in a group, but if you don't, the new instance just isn't a member of any group. simple as that β¨
The new instance's main.cf is the stock main.cf, except with the parameters that specify where the shared files live cloned over from the primary instance. For "nameless" instances though, you should manually adjust syslog_name so it gives you a unique "logtag" that starts with "postfix-" β that's the thing that'll uniquely identify the instance over in the mail logs. It's way simpler to just give the instance a short name with the -I name option, fr fr π
Optional "name=value" arguments let you specify the instance's config_directory, queue_directory and data_directory. Like, for example:
# postmulti -I postfix-mumble \
-G mygroup -e create \
config_directory=/my/config/dir \
queue_directory=/my/queue/dir \
data_directory=/my/data/dir
and if any of those pathnames isn't supplied, the program tries to generate the missing one(s) by taking the corresponding primary instance pathname and swapping the last pathname component out for the value of the -I option. cute, right? π
Oh and β if the instance configuration directory already exists, and it's got both a main.cf and a master.cf file in it, then create will "import" the instance exactly as-is. For existing instances, create and import are literally identical. periodt.
importβ imports an existing instance into the list of instances being managed by thepostmulti(1)multi-instance manager. This adds the instance to themulti_instance_directorieslist of the primary instance. If you provide the-I nameoption, it specifies the new name for the instance and is used to define a default location for the instance configuration directory (same deal ascreateabove). The-G groupoption can be used to assign the instance to a group. And you can add aconfig_directory=/pathargument to override a default pathname that's based on-I nameπdestroyβ destroys a secondary Postfix instance. To even be a candidate for destruction, an instance has to be disabled, stopped, and its queue has to have zero messages in it. And if you try to destroy the primary Postfix instance? that triggers a fatal error β it does not destroy the instance. π
The instance gets removed from the primary instance's main.cf file's alternate_config_directories parameter, and its data, queue and configuration directories get cleaned of the files and directories created by the Postfix system. The main.cf and master.cf files are removed from the configuration directory even if they've been modified since the instance was first created. And finally, the instance is "deported" from the list of managed instances.
If there are other files hanging out in the instance's private directories, those directories might not be fully removed, and a warning gets logged to alert the administrator. The expectation is that an instance built using "fresh" directories via the create action will be fully removed by the destroy action (as long as you disable it first). But if the instance's configuration and queue directories are populated with extra stuff (access and rewriting tables, chroot jail content, etc.), then the instance directories will not be fully removed. π«
β οΈ careful bestie β the destroy action triggers potentially dangerous file removal operations. Make absolutely sure the instance's data, queue and configuration directories are set correctly and do not contain any valuable files. like, seriously. π
deportβ deports a secondary instance from the list of managed instances. This deletes the instance configuration directory from the primary instance'smulti_instance_directorieslist, but it does not remove any files or directories. so it's like, a soft goodbye πΈassignβ assigns a new instance name or a new group name to the selected instance. Use-G -to specify"no group", and-I -to specify"no name". If you decide to make an instance "nameless", go set a suitablesyslog_namein the correspondingmain.cffile. iykyk πenableβ marks the selected instance as enabled. this literally just sets themulti_instance_enableparameter to"yes"in the instance'smain.cffile. slay β¨disableβ marks the selected instance as disabled. This means the instance won't be started etc. with"postfix start","postmulti -p start"and so on. It can still be started etc. with"postfix -c config-directory start"though, so keep that in mind π
β¨ Other options β¨
-vβ turns on verbose logging for debugging purposes. and the way that multiple-voptions stack?? each one makes the software increasingly verbose π₯
π¦ JSON OBJECT FORMAT π¦
The output is a sequence of lines. Each line contains one JSON object that represents the settings in a corresponding instance's main.cf file.
Object members have string values unless stated otherwise. Programs should ignore members that aren't listed here, because members may get added over time. π
nameβ the value of the correspondingmulti_instance_nameparameter, or"-"if no name is specified.groupβ the value of the correspondingmulti_instance_groupparameter, or"-"if no group is specified.enabledβ either"y"or"n", depending on whether the correspondingmulti_instance_enableparameter value is"yes"or"no".
note: this reports "y" for a primary instance, when multi-instance support is not enabled. π (iconic quirk honestly)
config_directoryβ the value of the correspondingconfig_directoryparameter.
π ENVIRONMENT π
The postmulti(1) command exports these environment variables before executing the requested command for a given instance, bestie:
MAIL_VERBOSEβ this one gets set when the-vcommand-line option is present.MAIL_CONFIGβ the location of the configuration directory of the instance.
π CONFIGURATION PARAMETERS π
config_directory(seepostconf -doutput) β the default location of the Postfixmain.cfandmaster.cfconfiguration files.daemon_directory(seepostconf -doutput) β the directory that holds Postfix support programs and daemon programs.import_environment(seepostconf -doutput) β the list of environment variables that a privileged Postfix process will import from a non-Postfix parent process, orname=valueenvironment overrides.multi_instance_directories(empty) β an optional list of non-default Postfix configuration directories; these directories belong to additional Postfix instances that share the Postfix executable files and documentation with the default Postfix instance, and that are started, stopped, etc., together with the default Postfix instance.multi_instance_group(empty) β the optional instance group name of this Postfix instance.multi_instance_name(empty) β the optional instance name of this Postfix instance.multi_instance_enable(no) β allow this Postfix instance to be started, stopped, etc., by a multi-instance manager.postmulti_start_commands(start) β thepostfix(1)commands that thepostmulti(1)instance manager treats as "start" commands.postmulti_stop_commands(seepostconf -doutput) β thepostfix(1)commands that thepostmulti(1)instance manager treats as "stop" commands.postmulti_control_commands(reload flush) β thepostfix(1)commands that thepostmulti(1)instance manager treats as "control" commands, i.e. the ones that operate on running instances.syslog_facility(mail) β the syslog facility of Postfix logging.syslog_name(seepostconf -doutput) β a prefix that gets prepended to the process name in syslog records, so that, for example,"smtpd"becomes"prefix/smtpd".
Available in Postfix 3.0 and later:
meta_directory(seepostconf -doutput) β the location of non-executable files that are shared among multiple Postfix instances, such aspostfix-files,dynamicmaps.cf, and the multi-instance template filesmain.cf.protoandmaster.cf.proto.shlib_directory(seepostconf -doutput) β the location of Postfix dynamically-linked libraries (libpostfix-*.so), and the default location of Postfix database plugins (postfix-*.so) that have a relative pathname in thedynamicmaps.cffile.
π FILES π
$meta_directory/main.cf.proto, stock configuration file$meta_directory/master.cf.proto, stock configuration file$daemon_directory/postmulti-script, life-cycle helper program
β SEE ALSO β
postfix(1), Postfix control programpostfix-wrapper(5), Postfix multi-instance API
π README FILES π
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
MULTI_INSTANCE_README, Postfix multi-instance management
π HISTORY π
The postmulti(1) command was introduced with Postfix version 2.6. β¨
π§ LICENSE π§
The Secure Mailer license must be distributed with this software.
β¨ AUTHOR(S) β¨
okay so bestie, this whole masterpiece was not a solo project π β it's giving collab energy, and these are the icons who built it. show some respect, they're literally the main characters of Postfix π
- Victor Duchovni β at Morgan Stanley πΌ
- Wietse Venema β at IBM T.J. Watson Research
P.O. Box 704Yorktown Heights, NY 10598, USAπ¬ - Wietse Venema β also at Google, Inc.
111 8th AvenueNew York, NY 10011, USAπ
no cap, Wietse is on there twice β one man, two whole research empires, absolutely ate π not me being obsessed with that level of range
and that's the whole page, fr fr π«Ά you made it to the very end, which is iconic of you. the lil footer down there signs it off as POSTMULTI(1) with the source/series and date stamped at the bottom right β go give it a lil kiss goodnight πβ¨
bye bestie, go configure something gorgeous ππΈπ¦
π¦ where this page comes from
- alpine 3.24: postfix-doc 3.11.7-r0 Β· IPL-1.0 EPL-2.0
- arch rolling: postfix 3.11.7-1 Β· EPL-2.0 OR IPL-1.0 AND BSD-4-Clause-UC
- nixos 26.05: postfix 3.11.7
- nixpkgs unstable: postfix 3.11.7
- ubuntu stonking: postfix 3.11.7-1ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms