I would understand the question as :
"why is the foreground/background concept linked to the concept of scope ?"
for most people --scope means "run in the background" which is only a
side effect of what that command really does.
Maybe there is a need of some doc clarification, or get non-scope runs
also be foreground and leave backgrounding to the shell...
Anyway, the first step is to understand why there is this difference of
behaviour in the first place...
Post by Lennart Poettering Post by worz
Hello, I was wondering why systemd-run --scope needs to be
synchronous, it would be nice if someone could explain what happens
under the hood, and what prevents it from just putting the process
in the scope, and maybe just call the Abandon() method on the slice
object's org.freedesktop.systemd1.Scope interface, when for example
it is used in combination with --user, the scope is under
manager goes away? Note that there's not a specific usecase to cover
here, I am just interested in knowing why it isn't the other way.
Hmm, I am not sure what you precisely mean by "synchronous" in this
Is this about the bus calls being issued synchronously? We do that so
that at the time the user-specified command is executed we know for
sure that the resource limits and other things are in effect on it. If
we'd asynchronously register the scope and would already execute the
user's command, then these resource limits would only be applied
asynchronously, i.e. at some later point too, which is generally not
what is intended.
Or are you using the word "synchronous" in the context of foreground
vs. background? I.e. you want your process to be forked into the
background? That's actually done by default by systemd-run when you
don't use "--scope", where the executed process is moved into into the
background as a service.
Note that "systemd-run --scope" is little more than an
execve()-wrapper: if you want the whole thing to be running as a
shell managed background process, then suffix the line in "&" like you
would normally do too, when you don't use "systemd-run"...
But then again, I am not sure what you actually are looking for so
maybe my answers above completely miss the point...
20 rue des Jardins
Responsable de l'expertise Smile-ECS
email ***@smile.fr <mailto:***@smile.fr>
Twitter <https://twitter.com/GroupeSmile> Facebook
DÃ©couvrez lâunivers Smile, rendez-vous sur smile.eu
eco Pour la planÃšte, n'imprimez ce mail que si c'est nÃ©cessaire