[systemd-devel] Supporting ExecStartPre= and friends in `systemctl set-property` or `systemd-run -p`
Richard Maw
richard.maw at codethink.co.uk
Fri May 15 03:41:05 PDT 2015
On Fri, May 15, 2015 at 11:36:54AM +0100, Richard Maw wrote:
> On Fri, May 15, 2015 at 12:10:58PM +0200, Lennart Poettering wrote:
> > On Fri, 15.05.15 13:03, Ivan Shapovalov (intelfx100 at gmail.com) wrote:
> > > 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?
> >
> > Well, I think this isn't too bad, we could devise a simple escaping
> > scheme to cover this. For example, if we use "--" as separator, then
> > we could tell people to escape this as "\--" (which on the shell would
> > become "\\--") if they actually want it included in the command
> > line...
> >
> > I much prefer a syntax like this over reading things from arbitrary
> > files I must say...
> 3. Require that if users need to embed the separator in their command, that
> they use `sh -c`.
>
> systemd-run --name=foo.service /bin/sh -c '/bin/foo arg -- arg2' -- \
> --name=bar.service -p Nice=80 /bin/bar -- \
> -p Nice=20 --name=bazz.service
> /bin/sh -c '/usr/bin/bazz arg1 -- arg2'
Having pondered this a bit longer, I prefer this approach, as it adds no
special parsing logic to systemd, and anyone who's ever had to embed a '+' or
';' character into an -exec command in find will be familiar with this
approach.
More information about the systemd-devel
mailing list