[systemd-devel] service kills application differently on shutdown vs on stop

John graysky at archlinux.us
Mon Dec 14 12:52:40 UTC 2020


On Mon, Dec 14, 2020 at 12:39 AM Andrei Borzenkov <arvidjaar at gmail.com> wrote:
> If your application creates user session, on shutdown systemd will stop
> existing sessions and it happens independently of your service.

Andrei - Thank you for this info.  It caused me to search 'systemd
wait for user session on shutdown.'  It seems that in order to avoid
systemd killing my processes running as the kodi user without waiting,
I need to make certain that they aren't in the user.slice (traceable
by running `systemd-cgls`).  Removing the PAMName=login seems to
achieve this (as well removing systemd-user-sessions.service from
After=).

I need to do some testing before I call this solved but I plan to push
a commit to my github repo:
https://github.com/graysky2/kodi-standalone-service should others
reading this want to see the modified service.  Note that it looks
like I will need to add some udev rules to allow the kodi user to
shutdown the system which it could do when the PAMName=login was
present.


More information about the systemd-devel mailing list