[systemd-devel] Supporting ExecStartPre= and friends in `systemctl set-property` or `systemd-run -p`
Ivan Shapovalov
intelfx100 at gmail.com
Wed May 6 04:05:50 PDT 2015
On 2015-05-06 at 09:16 +0300, Andrei Borzenkov wrote:
> On Wed, May 6, 2015 at 5:52 AM, Ivan Shapovalov <intelfx100 at gmail.com
> > wrote:
> > On 2015-04-24 at 11:10 +0200, Lennart Poettering wrote:
> > > On Fri, 24.04.15 04:07, Ivan Shapovalov (intelfx100 at gmail.com)
> > > wrote:
> > >
> > > > - do `systemd-run` twice and somehow set up the dependencies
> > > > between
> > > > two transient units
> > >
> > > I'd be happy to take a patch that allows configuring deps for
> > > transient units when constructing them.
> >
> > Hi Lennart,
> >
> > I've just done this (also added manager-side support for
> > JoinsNamespaceOf= and RequiresMountsFor=, while at it). However,
> > this
> > turned out to be insufficient for my usecase.
> >
> > I have to start two transient services, say, A.service and
> > B.service,
> > and
> >
> > - B.service "needs" A.service
> > (i. e. B.service Requires=A.service and After=A.service)
> >
> > - A.service must be stopped as soon as B.service exits
> > (i. e. A.service BindsTo=B.service)
> >
> > And there is a contradiction: I can't make a dependency on an
> > inexistent unit.
> > If I create A.service before B.service, I can't set BindsTo=, and
> > if I
> > create B.service before A.service, I can't set Requires= and
> > After=.
> >
> > Locally, I've solved this by allowing inverse dependencies to be
> > set
> > over the bus. That is, I make B.service BoundBy=A.service. Is this
> > acceptable for upstream?
> >
>
> What about adding option --define-only (I do not care about actual
> name) that adds unit definition but does not start unit? Then you can
> define any number of transient units and then "systemctl start" them
> later.
I'm unsure how to fit this into the GC logic. Transient units get
unloaded (and hence removed from disk) once they become inactive.
If we create a transient unit without starting it at the same time
(before the GC has a chance to run), it will be immediately removed.
--
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150506/60829129/attachment.sig>
More information about the systemd-devel
mailing list