Re: [exim] socket bind() to port 25 for address (any IPv4) f…

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: exim-users
Subject: Re: [exim] socket bind() to port 25 for address (any IPv4) failed (#76)
Jeremy Harris via Exim-users <exim-users@???> (Sa 04 Apr 2020 12:13:36 CEST):
> On 04/04/2020 10:08, Ian Zimmerman via Exim-users wrote:
> > AFAIK running exim under systemd (as the OP clearly does) requires -f in
> > any case.
>
> I don't think so. Here's a unit file I'm using
> (though I have no idea if it is optimal) :-


True, you do not have to have the service running in foreground mode.
But it would make systemd happier.

> [Service]
> PIDFile=/var/spool/exim/exim.pid
> Environment=QUEUE=5m
> Environment=PIDFILE=/var/spool/exim/exim.pid
> EnvironmentFile=-/etc/sysconfig/exim
> ExecStartPre=-/usr/libexec/exim-gen-cert
> ExecStart=/usr/sbin/exim -bd -oP ${PIDFILE} -q${QUEUE}


You're starting it in forking mode. systemd would be happier, if you let
it run in foreground, but that's not a must. I believe, using
Type=forking in your case would be advised.

> ExecReload=/bin/sh -c 'kill -s HUP `cat ${PIDFILE}`'


And perhaps using PIDFile=${PIDFILE} (not sure if ${…} works here)
or GuessMainPID does a good job already and you can simply
ExecReload=kill -s HUP ${MAINPID}

Here is mine:

    # /lib/systemd/system/exim4-daemon-exim.org.service
    [Unit]
    Description=Exim MTA


    [Service]
    EnvironmentFile=/etc/default/exim4-daemon-exim.org
    ExecStart=/usr/sbin/exim -bdf ${DAEMON_OPTS}
    ExecReload=/bin/kill -HUP ${MAINPID}
    #this made problems on a system
    #ProtectSystem=full
    #ReadWriteDirectories=/var/spool/exim4
    #ReadWriteDirectories=/var/log/exim4



    [Install]
    WantedBy=multi-user.target
    Alias=exim4.service


    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
--
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
 gnupg encrypted messages are welcome --------------- key ID: F69376CE -