[systemd-devel] PAMName=login, systemctl stop

Lennart Poettering lennart at poettering.net
Mon Jul 3 11:17:34 UTC 2023


On Mo, 03.07.23 10:58, Valentijn Sessink (valentijn at sessink.nl) 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

if you want to know which systemd unit your process belongs to use:

    ps --pid $$ -o unit=

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list