On Mo, 03.07.23 15:21, Andrei Borzenkov (arvidjaar@xxxxxxxxx) wrote: > On 03.07.2023 14:17, Lennart Poettering wrote: > > On Mo, 03.07.23 10:58, Valentijn Sessink (valentijn@xxxxxxxxxx) wrote: > > > > > Now my remaining question is probably so very basic, that you sort of missed > > > it: my "session" is started from a script and so I'm probably able to stop > > > all services in the session from within this script - if I knew how to find > > > "it": "it" being "the thing to stop", i.e. "my own session" or something > > > like that. I.e. the script should kill itself and all its children. > > > > logind's session ID you'll find in the $XDG_SESSION_ID env var. > > > > you can use this to kill your own session: > > > > loginctl kill-session $XDG_SESSION_ID > > > > It is not defined here on Ubuntu 22.04 with GNOME 42 that is using systemd > for session management. It *is* defined in GDM session worker, but as actual > session processes are not children of it (they are started by systemd) this > variable is not inherited. GNOME doesn#t run in a logind session, but as services off the user@.service instead, i.e. in session context rather than login session context. Hence it doesn't have XDG_SESSION_ID set. This is different if you use PAMName= for arbitrary services. That means you get a proper session allocated, and hence also XDG_SESSION_ID set. Lennart -- Lennart Poettering, Berlin