Joachim Schrod said the following on 04/22/2013 07:57 PM:
Hi,
I got a service, actually a Tomcat 5, that runs under a network-wide user/group id, i.e., one that's supplied by NIS (LDAP would be the same story). This service wants to store PID files somewhere. I want to use /run/tomcat5/ for that. This directory must be owned by the server's run user id.
I can't create this directory via /etc/tmpfiles.d: systemd-tmpfiles-setup.service must not depend on ypbind.service, this would result in a dependency deadlock.
Is there an "official" method to assert the existence of a directory in a systemd service unit definition, with appropriate create actions to be done when a service is started? I could use ExecStart and supply a script, to be executed with root rights; but I hope that the demands of using network-supplied resources is more widespread and thus predefined solutions exist. -- But, I haven't found them in man pages of systemd.unit and systemd.service.
Maybe, just maybe ... Have that directory created anyway. Don't worry about making systemd-tmpfiles-setup.service must not depend on ypbind.service at this stage. By the time you get to start Tomcat the ypbind has started, right? At this point you have a number of options. There are a few ways you can use ExecStartPre The "Pre" means ... well that should be obvious. Run a grep on the directory with all the service files and find a few examples. Some, like dbus.service, have multiple "ExecStartPre" lines. I see quite a few "kill" and "rm"; I don't see why you can't do a 'chown'. Of course you could do the directory create there, but my personal inclination is that all the directories under /run should be managed from one and only point. There are also ways you can use dbus to do nifty things ... -- To avoid criticism do nothing, say nothing, be nothing. Elbert Hubbard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org