How do I run a command in a different already existing systemd session or scope?
As far as I can tell there is no difference between a session and the session's scope unit, as far as processes being in one or the other is concerned.
This question comes up because in Gnome, commands run from the terminal are seen as part of the gnome-terminal-server.service
, not as part of the session-xx.scope
. If I want to run a command in my session (or in another session for that matter) how do I do that?
(NB: this is the reverse of this question, which asks to create a new scope around existing processes.)
busctl --user introspect org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager
, you may have success withAttachProcessesToUnit
. I couldn't get it to work myself, sadly.