[Date Prev][Date Next]
Re: (ITS#8707) slapd: Add systemd service notification support
- To: openldap-its@OpenLDAP.org
- Subject: Re: (ITS#8707) slapd: Add systemd service notification support
- From: email@example.com
- Date: Mon, 07 Aug 2017 20:12:15 +0000
- Auto-submitted: auto-generated (OpenLDAP-ITS)
On Mon, Aug 07, 2017 at 12:23:27PM -0700, Ryan Tandy wrote:
>I guess MAINPID= is actually needed, unless we run slapd with -d, regardless of
>whether we set Type=forking or Type=notify. Not exactly "needed", but better to
>have it than not.
I experimented a bit with a service file. It seems to work well with
either Type=forking and NotifyAccess=all, or Type=notify and
ExecStart=slapd -d none. The latter (disabling forking) is definitely
what systemd upstream recommends.
In either case, MAINPID= didn't actually seem to help anything.
NotifyAccess=main has a chicken-and-egg problem, because systemd needs
to know the main PID in order for us to send it the message containing
the PID! :) I think the only reasonable way to leave forking enabled
would be to also require a PIDFile= setting, which solves that problem.
But I'd rather sidestep the entire thing, omit MAINPID= as well, and
Looking at the systemctl output I still think STATUS= is redundant and
could be omitted.
So I guess my recommendation for the notify call boils down to:
rc = sd_notify( 1, "READY=1" );
and a slapd.service along the lines of:
ExecStart=%LIBEXECDIR%/slapd -h 'ldap:/// ldapi:///' -d0
(basically identical to the example in systemd.service(5).)
Side note: the version message from slapd appears in the journal twice,
once with the timestamp and once without... not sure exactly why!