[systemd-devel] Supporting ExecStartPre= and friends in `systemctl set-property` or `systemd-run -p`
Ivan Shapovalov
intelfx100 at gmail.com
Thu Apr 23 18:07:54 PDT 2015
On 2015-04-08 at 19:28 +0200, Lennart Poettering wrote:
> On Mon, 23.03.15 16:04, Ivan Shapovalov (intelfx100 at gmail.com) wrote:
>
> > Hello,
> >
> > is it possible/allowed/desired to support assigning ExecStartPre=
> > and
> > similar options via dbus interface, i. e. in `systemctl set
> > -property` or
> > `systemd-run -p`?
>
> So far our philosophy for allowing dynamically changable properties
> is
> that we do this only for properties we can actually really alter
> dynamically at runtime. For example, properties that map to cgroup
> attributes are of this kind, as we can pass them to the kernel
> immediately so that they take effect. However, other properties, like
> for example the nice level are not of this kind, since we can
> reasonably set them only while forking off processes, and afterwards
> it is not clear what to set them on (just the main process? all
> processes? and what to do if the service altered its own nice level,
> and applied different levels to different procecesses, what do we do
> then?).
>
> ExecStartPre= is a property we cannot really adjust dynamically,
> after
> all it specifies what to execute, and that's only relevant during
> service startup?
>
> > I'm hitting a usecase when I need to run a service with multiple
> > executed processes via `systemd-run`. I think this makes sense to
> > support, isn't it?
>
> Can you elaborate on this? A service with multiple processes?
> In parallel? Normally we recommend a 1:1 mapping between services and
> forked off processes, i.e. never fork off multiple processes for the
> same service (unless the service does that internally...). The only
> exception to this logic is for Type=oneshot services, where we allow
> multiple processes, but only serialized, not parallel.
>
> Anyway, I don't really grok what you want to to...
OK, in avoidance of an X-Y problem, I'll describe the initial task. I
would like to run a vnc connection tunneled over ssh. This requires
running two binaries: an ssh client in TCP port forwarding mode and a
vnc client. They are started one after another. The second one is
terminated at user's choice, the first one has no knowledge of "vnc
session ended" and hence should be manually terminated.
This could be solved with templated units, but there is more than one
parameter to pass (both to ssh and vnc clients). So, I need to
generate units on the fly. There are three possibilities:
- generate two units manually and somehow "mark" them as transient
so that they will be removed after stop
- do `systemd-run` twice and somehow set up the dependencies between
two transient units
- do `systemd-run` once, starting ssh client in ExecStartPre= and vnc
client in ExecStart=
Neither of these is possible at the moment. How can this be achieved?
Thanks,
--
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/20150424/8db80dc9/attachment-0001.sig>
More information about the systemd-devel
mailing list