[Freeipa-devel] 389 systemd changes

Alexander Bokovoy abokovoy at redhat.com
Mon Jan 23 06:03:48 UTC 2012


On Sun, 22 Jan 2012, Simo Sorce wrote:
> > > Shouldn't we just 'include' the original file and not copy it ?
> > > If we include it a change in the file will be automatically picked up.
> > We can't due to systemd design and use of it in 389-ds.
> > 
> > LimitNOFILE needs to be changed in the service file directly, not in 
> > the environment file in /etc/sysconfig or otherwise it will not be 
> > picked up by the systemd.
> 
> I am not talking about using /set/sysconfig options, but the .include
> directive for service files.
So, something like this for 389-ds?
----8<--------8<--------8<---------
[Unit]
Description=389 Directory Server %i.
BindTo=dirsrv.target
After=dirsrv.target

[Service]
Type=forking
Environment=PIDDIR=/var/run/dirsrv
EnvironmentFile=/etc/sysconfig/dirsrv
EnvironmentFile=/etc/sysconfig/dirsrv-%i
ExecStart=/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-%i -i ${PIDDIR}/slapd-%i.pid -w ${PIDDIR}/slapd-%i.startpid
.include /etc/sysconfig/dirsrv.systemd
----8<--------8<--------8<---------

and then with following /etc/sysconfig/dirsrv.systemd:
----8<--------8<--------8<---------
[Service]
LimitNOFILE=8192
----8<--------8<--------8<---------

local overrides can be created?

It seems to work. You can't use %i macro in .include unfortunately so 
any configuration change will be global, not per service instance.

# systemctl show dirsrv at IPA-LOCAL.service|grep LimitNOFILE
LimitNOFILE=8192
# systemctl status dirsrv at IPA-LOCAL.service
dirsrv at IPA-LOCAL.service - 389 Directory Server IPA-LOCAL.
	  Loaded: loaded (/lib/systemd/system/dirsrv at .service; enabled)
	  Active: active (running) since Mon, 23 Jan 2012 00:47:32 -0500; 11min ago
	 Process: 30927 ExecStart=/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-%i -i ${PIDDIR}/slapd-%i.pid -w ${PIDDIR}/slapd-%i.startpid (code=exited, status=0/SUCCESS)
	Main PID: 30929 (ns-slapd)
	  CGroup: name=systemd:/system/dirsrv at .service/IPA-LOCAL
		  └ 30929 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-IPA-LOCAL -i /var/run/dirsrv/slapd-IPA-LOCAL.p...

I would still need a ticket to make appropriate removals in 
ipapython/platform/fedora16.py so that we would modify 
/etc/sysconfig/dirsrv.systemd and still do symlink re-linking in 
/etc/systemd/system/dirsrv.target.wants/.
-- 
/ Alexander Bokovoy




More information about the Freeipa-devel mailing list