I finally managed to get sendmail working using systemd.

Here is my /etc/systemd/system/sendmail.service:

[Unit]
Description=Sendmail Mail Transport Agent
Requires=clamav-daemon.service spamassassin.service
After=syslog.target network.target clamav-daemon.service
spamassassin.service
Conflicts=postfix.service exim.service

[Service]
Type=forking
PIDFile=/run/sendmail/mta/sendmail.pid
Environment=SENDMAIL_OPTS=-q1h
EnvironmentFile=-/etc/default/sendmail
ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG

[Install]
WantedBy=multi-user.target

and my /etc/tmpfiles.d/sendmail.conf file:
d /run/sendmail/ 0755 smmta smmsp
d /run/sendmail/mta/ 0755 smmta smmsp

I am using clamav-milter and spamass-milter, hence the Requires= and After=
lines.  If you are not using these, probably you should remove those.

Is it wrong to include these dependencies in sendmail.system?  The thing
is, these milters are not specific to sendmail.  Other mailers that support
the milter interface can use them as well.  And they are not required for
sendmail.  So I wonder which pakage's responsibility it would be to add
these dependencies to sendmail.system or if this is even the correct place
to do that.

With the init.d, clamav-milter and spamass-milter install themselves with a
lower number than sendmail and always start before whatever mailer is
installed.  Once you go to explicit dependencies like this, is it clam's
and spamassassin's job to know all the possible mailers out there that
might use it?  Or is it sendmail's job to know all the possible milters out
there and state them as dependencies?

Another observation, to get this working, the only way I found to properly
test this was to continually reboot.  I could get sendmail to start by hand
quite early on, but it was not starting by on reboot because of the timing
problem in the dependencies.  This makes systemd rather more difficult to
debug things in my opinion.

Reply via email to