[systemd-devel] Supporting ExecStartPre= and friends in `systemctl set-property` or `systemd-run -p`

Ivan Shapovalov intelfx100 at gmail.com
Fri May 15 03:03:10 PDT 2015


On 2015-05-15 at 11:54 +0200, Lennart Poettering wrote:
> 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...

Hm. Actually, usage of *any* token as a command line separator makes it
impossible to include that token *in* the command line. My original
idea is even worse as it disallows ever giving "--aux-unit" switch to
the client program. So I guess I retract that idea...
What about the second one?

-- 
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/20150515/0273e18c/attachment.sig>


More information about the systemd-devel mailing list