Gerben Wierda:
> postfix is started during boot on my macOS system. This fails with:
> 
> Jan 10 18:00:08 mail postfix/master[488]: fatal: bind 0.0.0.0 port 25: 
> Address already in use
> Jan 10 18:00:10 mail /postfix-script[511]: fatal: mail system startup failed

On most UNIX(like) system this means that some process hold
a file descriptor that is bound to that address and port. 

For example, an smtpd process still runs after something has killed
the Postfix master daemon.

But that seems unlikely during system boot.

> but when I shortly thereafter launch it it just starts fine.

> Probably a weirdness in macOS if postfix starts when the system
> is still in some startup state (there have been more issues like
> this with macOS), so what I could use is a way to make postfix a
> bit more persistent in trying to start on a fatal.

You could duplicate the "postfix stop" retry loop.

        Wietse

        $INFO stopping the Postfix mail system
        kill `sed 1q pid/master.pid`
        for i in 5 4 3 2 1
        do
            $daemon_directory/master -t && exit 0
            $INFO waiting for the Postfix mail system to terminate
            sleep 1
        done
        $WARN stopping the Postfix mail system with force
        pid=`awk '{ print $1; exit 0 } END { exit 1 }' pid/master.pid` && 
                kill -9 -$pid

Reply via email to