Ubuntu – `systemctl reload sendmail` throws `Job type not applicable”

sendmailsystemd

When I try to use systemctl to reload the sendmail configuration I get an error. Is this a bug or should I just avoid trying to use systemctl with sendmail?

What is the recommended way to teach systemctl to allow reload for the sendmail.service?

Please no religious debates on systemd.

Output of systemctl reload sendmail:

Failed to reload sendmail.service: Job type reload is not applicable for unit sendmail.service.
See system logs and 'systemctl status sendmail.service' for details.

And systemctl status sendmail.service:

● sendmail.service - LSB: powerful, efficient, and scalable Mail Transport Agent
   Loaded: loaded (/etc/init.d/sendmail; bad; vendor preset: enabled)
   Active: active (running) since Tue 2016-09-20 15:13:35 CDT; 7h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1476 ExecStart=/etc/init.d/sendmail start (code=exited, status=0/SUCCESS)
    Tasks: 1
   Memory: 3.2M
      CPU: 805ms
   CGroup: /system.slice/sendmail.service
           └─1621 sendmail: MTA: accepting connections

Sep 20 15:48:45 yin.bl-3.com sm-mta[2407]: u8KKmjv5002407: SYSERR(root): btree map "drac": missing map file /var/lib/drac/drac.db: No such file or directory
Sep 20 15:48:45 yin.bl-3.com sm-mta[2407]: u8KKmjv5002407: ruleset=check_rcpt, arg1=<Postmaster@mayrich.net>, relay=mx.cableone.net [64.8.70.47], reject=550 5.7.1 <Postmaster@mayrich.net>... Relaying denied
Sep 20 15:48:50 yin.bl-3.com sm-mta[2407]: u8KKmjv5002407: from=<>, size=0, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=mx.cableone.net [64.8.70.47]
Sep 20 15:53:57 yin.bl-3.com sm-mta[2433]: u8KKrvRq002433: SYSERR(root): btree map "drac": missing map file /var/lib/drac/drac.db: No such file or directory
Sep 20 15:53:57 yin.bl-3.com sm-mta[2433]: u8KKrvRq002433: ruleset=check_rcpt, arg1=<Postmaster@mayrich.net>, relay=mx.cableone.net [64.8.70.47], reject=550 5.7.1 <Postmaster@mayrich.net>... Relaying denied
Sep 20 15:54:02 yin.bl-3.com sm-mta[2433]: u8KKrvRq002433: from=<>, size=0, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=mx.cableone.net [64.8.70.47]
Sep 20 16:03:45 yin.bl-3.com sm-mta[2503]: u8KL3je5002503: SYSERR(root): btree map "drac": missing map file /var/lib/drac/drac.db: No such file or directory
Sep 20 16:03:45 yin.bl-3.com sm-mta[2503]: u8KL3je5002503: ruleset=check_rcpt, arg1=<Postmaster@mayrich.net>, relay=mx.cableone.net [64.8.70.47], reject=550 5.7.1 <Postmaster@mayrich.net>... Relaying denied
Sep 20 16:03:50 yin.bl-3.com sm-mta[2503]: u8KL3je5002503: from=<>, size=0, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=mx.cableone.net [64.8.70.47]
Sep 20 20:02:53 yin.bl-3.com sm-mta[4051]: ruleset=check_relay, arg1=[185.40.4.126], arg2=127.0.0.3, relay=m126.mediumthings.net [185.40.4.126] (may be forged), reject=553 5.3.0 Message From 185.40.4.126 rejected -see http://spamhau
~

Best Answer

That error typically means that the client program (in this case sendmail) doesn't expose a reload method to systemctl to use. This is the fault of the developers/maintainers, and not systemctl. (Perhaps sendmail can't just plain reload the configs?)

I would recommend just plain restarting sendmail whenever you need to reload the configuration:

sudo systemctl restart sendmail

This will kill sendmail and then start it up again as a fresh daemon instance. As a result, any new config changes will take effect, but you may lose temporary data.