09.12.2024 22:25, Wietse Venema via Postfix-users wrote:
Steffen Nurpmeso via Postfix-users:
   postfix_status() {
   # As postfix does not use stdout but console, no
   #        postfix__init
   #        ${prog} status 2>&1

I think that was fixed in Postfix 3.8.

20230308

         Cleanup: the postfix(1) and postlog(1) commands now produce
         stderr output even when stderr is not connected to a terminal.
         This eliminates an inconsistency, and makes these programs
         easier to use in some automated procedures. The canonical
         example is to capture output from "postmulti -p status" to
         figure out which instances are or are not running. Files:
         postfix/postfix.c, postlog/postlog.c.
The postlog manpage states:
       By default, logging is sent to syslogd(8) or postlogd(8); when
       the standard error stream is connected to a terminal, logging
       is sent  there  as well.

I was confused by this description, while trying to understand why,
when the system startup tools captures command output into logs,
there are two messages produced:

Dec 14 09:27:25 gandalf postfix[165466]: postfix/postlog: starting the Postfix 
mail system
Dec 14 09:27:25 gandalf postfix/postfix-script[165466]: starting the Postfix 
mail system

One is sent by postlog to the syslog, and another is captured from
the stderr/out.  It's an interesting effect.

But this only happens when the system startup tools captures the
output, notable any systemd-based system.  The complete sequence
looks like:

Dec 14 09:27:25 gandalf systemd[1]: Starting postfix.service - Postfix Mail 
Transport Agent (main/default instance)...
Dec 14 09:27:25 gandalf postfix[165466]: postfix/postlog: starting the Postfix 
mail system
Dec 14 09:27:25 gandalf postfix/postfix-script[165466]: starting the Postfix 
mail system
Dec 14 09:27:25 gandalf postfix/master[165468]: daemon started -- version 
3.9.1, configuration /etc/postfix
Dec 14 09:27:25 gandalf systemd[1]: Started postfix.service - Postfix Mail 
Transport Agent (main/default instance).

/mjt
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to