[systemd-devel] Supporting ExecStartPre= and friends in `systemctl set-property` or `systemd-run -p`
Lennart Poettering
lennart at poettering.net
Fri May 15 02:54:40 PDT 2015
On Fri, 15.05.15 11:38, Ivan Shapovalov (intelfx100 at gmail.com) wrote:
> > Hmm, if , I think this should be fixable though. Already,
> > allocating a unit, loading a unit and starting a unit are three
> > separate steps. It shouldn't be too hard to fix PID 1 to allow
> > allocating all transient units to create in a group first, then in
> > a second step load all of them, and finally start one of
> > them. With such an order in place it should be easily possible to
> > do what you want to do, no?
>
> Yeah, makes sense. I'll try to do that in meantime.
>
> BTW, regarding creating aux units from systemd-run(1). I guess it can
> be done in two ways:
>
> - "--aux-unit" parameter which adds another aux unit and makes all
> following parameters (until another --aux-unit) set parameters of this
> new aux unit (i. e. stateful command line);
>
> - "--aux-units-from-file" parameter or something like that which reads
> the given file and parses each line of it as a separate command line,
> creating an aux unit from it.
>
> The former would look like this:
>
> $ systemd-run --name foo.service -p Wants=aux-1.service /bin/foo \
> --aux-unit --name aux-1.service -p BindsTo=foo.service /bin/aux-1
>
> The latter (in bash syntax) would look like this:
>
> $ systemd-run --name foo.service -p Wants=aux-1.service /bin/foo \
> --aux-units-from-file /dev/stdin <<-EOF
> --name aux-1.service -p BindsTo=foo.service /bin/aux-1
> EOF
>
> Would any of this be OK?
Hmm, what about this: use "--" as separator for multiple unit
definitions?
$ systemd-run --name=foo.service /bin/foo -- --name=bar.service -p
Nice=80 /bin/bar -- -p Nice=20 --name=bazz.service /usr/bin/bazz
Alternatively, we could use ";" as separator, similar to /usr/bin/find
does it... But I think "--" is nicer...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list