Hi,
Sorry, I'm not good at English. :-)
On Tue, 08 Aug 2017 05:12:02 +0900, 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.
I think so too. I don't like forking, thus I use "Type=notify" and "ExecStart=slapd -d0 ..." in my slapd.service file.
In either case, MAINPID= didn't actually seem to help anything.
Yes.
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" );
Agreed. I'll fix servers/slapd/daemon.c later. Thank you.
and a slapd.service along the lines of:
[Unit] Description=OpenLDAP server
[Service] Type=notify ExecStart=%LIBEXECDIR%/slapd -h 'ldap:/// ldapi:///' -d0
[Install] WantedBy=multi-user.target
(basically identical to the example in systemd.service(5).)
My slapd.service file:
[Unit] Description=OpenLDAP Server After=syslog.target network-online.target Documentation=man:slapd Documentation=man:slapd.conf Documentation=man:slapd-config Documentation=man:slapd-bdb Documentation=man:slapd-hdb Documentation=man:slapd-mdb
[Service] Type=notify ExecStart=%LIBEXECDIR%/slapd -d 0 -h "ldapi:/// ldap:///"
[Install] WantedBy=multi-user.target
Any comment?